AWS codebuild 失败,并显示错误:- COMMAND_EXECUTION_ERROR:执行命令时出错:yarn run build。原因:退出状态1
我正在尝试使用 aws codebuild 来创建 ci/cd 管道。我使用纱线作为包管理器。这是我的构建规范文件。
# Do not change version. This is the version of aws buildspec, not the version of your buldspec file.
version: 0.2
phases:
install:
commands:
- echo update npm...
- npm install -g n
- n latest
- npm update -g npm
- echo node -v
- node -v
- echo npm -v
- npm -v
- echo install yarn...
- npm install -g yarn
- echo yarn -v
- yarn -v
pre_build:
commands:
#installs dependencies into the node_modules/ directory
- echo Entered the pre_build phase...
- yarn install
build:
commands:
- echo Build started on `date`
- echo Compiling
- yarn run build
post_build:
commands:
- echo Build completed on `date`
# Include only the files required for your application to run.
artifacts:
files:
- public/**/*
- src/**/*
- package.json
- appspec.yml
- scripts/**/*
PS:由于某种原因,仅编写纱线在预构建阶段不起作用。但现在它在构建阶段显示错误。
COMMAND_EXECUTION_ERROR: Error while executing command: yarn run build. Reason: exit
status 1
由于我是 AWS 新手,我无法找到解决方案。如果可能的话,请帮助我。 谢谢
I am trying to aws codebuild for creating ci/cd pipeline. I have used yarn as package manager. Here is my buildspec file.
# Do not change version. This is the version of aws buildspec, not the version of your buldspec file.
version: 0.2
phases:
install:
commands:
- echo update npm...
- npm install -g n
- n latest
- npm update -g npm
- echo node -v
- node -v
- echo npm -v
- npm -v
- echo install yarn...
- npm install -g yarn
- echo yarn -v
- yarn -v
pre_build:
commands:
#installs dependencies into the node_modules/ directory
- echo Entered the pre_build phase...
- yarn install
build:
commands:
- echo Build started on `date`
- echo Compiling
- yarn run build
post_build:
commands:
- echo Build completed on `date`
# Include only the files required for your application to run.
artifacts:
files:
- public/**/*
- src/**/*
- package.json
- appspec.yml
- scripts/**/*
PS: Here for some reason by writing only yarn is not working in prebuild phase. But now its showing error in build phase.
COMMAND_EXECUTION_ERROR: Error while executing command: yarn run build. Reason: exit
status 1
As I am new to aws I am unable to find solution. Please help me in this if possible.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论