amplify npm not installing all packages

0

I have a weird situation with amplify console frontend not installing all of the packages and thus I am getting a module not found error.

It worked initially but I had errors with environment variables that I had to fix. I then fixed the variables and nothing I can do will allow me to get past this point. I reverted everything and I still get the same error.

Things I have tried

  • Removing the cache in the yml file and node 12 the nvm environment.
  • Removing all node_modules and directory prior to running npm ci
  • Using npm install instead of npm ci
  • Using npm install --force (to bypass cache)
  • updating my package-lock.json file
  • running locally with npm ci which, I receive ("added 1963 packages in 33.668s") and it works.

Here is my yml file:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    # IMPORTANT - Please verify your build output directory
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Here is the error

2020-07-10T15:35:02.103Z [INFO]: # Executing command: npm ci
2020-07-10T15:35:05.346Z [INFO]: added 170 packages in 2.427s
2020-07-10T15:35:05.352Z [INFO]: # Completed phase: preBuild
                                 # Starting phase: build
                                 # Executing command: npm run build
2020-07-10T15:35:05.500Z [INFO]: > team-chat@0.8.0 build /codebuild/output/src889768276/src/pubnub-chat
                                 > node setup/populate.js --quick-test && react-scripts build
2020-07-10T15:35:05.678Z [WARNING]: internal/modules/cjs/loader.js:716
                                    throw err;
                                    ^
                                    Error: Cannot find module 'cli-progress'
                                    Require stack:
                                    - /codebuild/output/src889768276/src/pubnub-chat/setup/populate.js
                                    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:713:15)
                                    at Function.Module._load (internal/modules/cjs/loader.js:618:27)
                                    at Module.require (internal/modules/cjs/loader.js:771:19)
                                    at require (internal/modules/cjs/helpers.js:68:18)
                                    at Object.<anonymous> (/codebuild/output/src889768276/src/pubnub-chat/setup/populate.js:3:22)
                                    at Module._compile (internal/modules/cjs/loader.js:868:30)
                                    at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)
                                    at Module.load (internal/modules/cjs/loader.js:731:32)
                                    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
                                    at Function.Module.runMain (internal/modules/cjs/loader.js:931:10) {
                                    code: 'MODULE_NOT_FOUND',
                                    requireStack: [
                                    '/codebuild/output/src889768276/src/pubnub-chat/setup/populate.js'
                                    ]
                                    }
2020-07-10T15:35:05.682Z [WARNING]: npm
2020-07-10T15:35:05.684Z [WARNING]: ERR! code ELIFECYCLE
                                    npm ERR! errno 1
                                    npm ERR! team-chat@0.8.0 build: `node setup/populate.js --quick-test && react-scripts build`
                                    npm ERR! Exit status 1
                                    npm ERR!
yzfr1
asked 4 years ago3248 views
1 Answer
0

I figured out the issue. It was my own issue with devDependencies not loading because env is set to prod by default.

yzfr1
answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions