Search code examples
node.jsamazon-web-servicesexpressnode-modulesaws-amplify

AWS amplify build stuck with npm ci


I have build an small web application with node js express with html and css which starts from the below command in npm start app.js but the same thing doesnot work in aws amplify in order to launch this as serverless application.

Here is the log for the build phase in aws amplify.

# Starting phase: preBuild
                                 # Executing command: rm -r node_modules
2022-08-11T13:02:59.128Z [INFO]: # Executing command: npm ci
2022-08-11T13:03:05.392Z [INFO]: added 173 packages in 5.946s

Here is the amplify.yml

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - rm -r node_modules
        - npm ci
    # IMPORTANT - Please verify your build commands
    build:
      commands:
        - npm start app.js

Please suggest.


Solution

  • For future reference,

    I had this issue. I changed npm ci to npm i in the amplify build config and it "worked" I went to my console and tried npm ci

    It told me there was a sync problem with the package.json and lock file and directed to run npm install.

    I ran npm install I changed the amplify config to try npm ci for my amplify build again

    This time the provision-build-deploy was green