title: Build Failed - Non-Zero Exit Code Detected after 'npm build' in AWS Amplify
body: <p>I am linked my AWS Amplify app to a new React Gatsby GitHub repo for continuous deployment. The app compiles fine locally, but I am getting an error in the 'Frontend' during the AWS build, saying that the amplify.sh file is 'killed' at the npm run build line, followed by 'Non-Zero Exit Code Detected' error. Below is a link to a screenshot of the error:</p>
  <p><a href="https://i.stack.imgur.com/3IJLO.png" rel="noreferrer">AWS Amplify Error</a></p>
  <p>Below are the contents of my amplify.yml file in AWS:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>version: 1
  frontend:
    phases:
      preBuild:
        commands:
          - npm ci
      build:
        commands:
          - npm run build
    artifacts:
      baseDirectory: public
      files:
        - '**/*'
    cache:
      paths:
        - node_modules/**/*</code></pre>
  </div>
  </div>
  </p>
  <p>Do I need to edit the amplify.yml file, or maybe add something to a package-lock or gatsby-node file?</p>