Amplify-console: Amplify Automated Code Pipeline for Gatsby App in monorepo fails at the build step

Created on 25 Sep 2020  路  2Comments  路  Source: aws-amplify/amplify-console

I have a gatsby app with an amplify backend working locally.

I have connected the app in the Amplify console to my github repo for the master branch and on commit to master the deploy process starts.

The build step fails with this error log output

2020-09-25T20:41:55.570Z [INFO]: # Starting phase: preBuild
                                 # Executing command: yarn install
2020-09-25T20:41:56.130Z [INFO]: yarn install v1.16.0
2020-09-25T20:41:56.252Z [INFO]: [1/4] Resolving packages...
2020-09-25T20:41:56.858Z [INFO]: [2/4] Fetching packages...
2020-09-25T20:42:13.555Z [INFO]: info @commitlint/[email protected]: The engine "node" is incompatible with this module. Expected version ">=v10.22.0". Got "10.16.0"
                                 info "@commitlint/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-09-25T20:42:13.556Z [INFO]: info @commitlint/[email protected]: The engine "node" is incompatible with this module. Expected version ">=v10.22.0". Got "10.16.0"
                                 info "@commitlint/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
                                 info @commitlint/[email protected]: The engine "node" is incompatible with this module. Expected version ">=v10.22.0". Got "10.16.0"
                                 info "@commitlint/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
                                 info @commitlint/[email protected]: The engine "node" is incompatible with this module. Expected version ">=v10.22.0". Got "10.16.0"
                                 info "@commitlint/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-09-25T20:42:13.567Z [INFO]: info [email protected]: The platform "linux" is incompatible with this module.
2020-09-25T20:42:13.568Z [INFO]: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-09-25T20:42:13.572Z [WARNING]: error [email protected]: The engine "node" is incompatible with this module. Expected version "^10.17.0 || ^12.0.0 || >= 13.7.0". Got "10.16.0"
2020-09-25T20:42:13.583Z [WARNING]: error Found incompatible module.
2020-09-25T20:42:13.584Z [INFO]: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2020-09-25T20:42:13.599Z [ERROR]: !!! Build failed
2020-09-25T20:42:13.675Z [ERROR]: !!! Non-Zero Exit Code detected
2020-09-25T20:42:13.675Z [INFO]: # Starting environment caching...
2020-09-25T20:42:13.675Z [INFO]: # Environment caching completed
Terminating logging...

The Gatsby app is ./demo

The build settings are:

version: 1
applications:
  - backend:
      phases:
        build:
          commands:
            - '# Execute Amplify CLI with the helper script'
            - amplifyPush --simple
    frontend:
      phases:
        preBuild:
          commands:
            - yarn install
        build:
          commands:
            - yarn run build
      artifacts:
        baseDirectory: public
        files:
          - '**/*'
      cache:
        paths:
          - node_modules/**/*
    appRoot: demo

It looks like the failure is at the install step.
Anyone seen a similar error? How can I go about troubleshooting this?

Most helpful comment

I ran into this problem too. Amplify uses nvm to manage versions of node so you can do something like this:

frontend:
  phases:
    preBuild:
      commands:
        - nvm install 12.0.0
        - nvm use 12.0.0
        - yarn install
    build:
      commands:
        - nvm install 12.0.0
        - nvm use 12.0.0
        - node -v
        - yarn run build

All 2 comments

I ran into this problem too. Amplify uses nvm to manage versions of node so you can do something like this:

frontend:
  phases:
    preBuild:
      commands:
        - nvm install 12.0.0
        - nvm use 12.0.0
        - yarn install
    build:
      commands:
        - nvm install 12.0.0
        - nvm use 12.0.0
        - node -v
        - yarn run build

Thanks. That solves the issue for me and now I know about using nvm in Amplify! I am going to close the issue since this seems to fix it.

Was this page helpful?
0 / 5 - 0 ratings