gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 12:01:56 25 4
gpt4 key购买 nike

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

version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: public
files:
- '**/*'
cache:
paths:
- node_modules/**/*

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

最佳答案

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

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

关于reactjs - 构建失败 - 在 AWS Amplify 中 'npm build' 后检测到非零退出代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68277746/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com