构建失败 - 在 AWS Amplify 中的“npm build”后检测到非零退出代码

mul*_*yle 6 amazon-web-services reactjs gatsby aws-amplify amplify

我将我的 AWS Amplify 应用程序链接到一个新的 React Gatsby GitHub 存储库以进行持续部署。该应用程序在本地编译良好,但我在 AWS 构建期间在“前端”中遇到错误,说 amplify.sh 文件在 npm run 构建行中“被杀死”,然后是“检测到非零退出代码”错误。下面是错误截图的链接:

AWS 放大错误

以下是我在 AWS 中的 amplify.yml 文件的内容:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: public
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
Run Code Online (Sandbox Code Playgroud)

我是否需要编辑 amplify.yml 文件,或者向 package-lock 或 gatsby-node 文件添加一些内容?

Usa*_*eem 0

你的剧本看起来不错。

您能否确认 IAM 角色“AWSAmplifyExecutionRole”具有 AdministratorAccess 权限?为了进行 CloudFormation 部署,角色需要该权限才能创建堆栈中的所有资源。

或者

如果可能,请分享错误日志内容。