突然之间,我的aws代码行构建项目开始解决这个错误。以前很好用。
COMMAND_EXECUTION_ERROR: Error while executing command: ng build --configuration production && ng run project-name:server. Reason: exit status 3
我的建筑规范
version: 0.2
env:
variables:
APP_NAME: "projectname"
CACHE_CONTORL : "86400"
S3_BUCKET: "https://s3.amazonaws.com/test1.project.com/"
BUILD_FOLDER: "projectname-ng/dist"
phases:
install:
runtime-versions:
nodejs: 14.x
commands:
- echo install process started
- npm install -g @angular/cli
- cd project-name-ng
- npm install
build:
commands:
- echo build process started now
- ng build --configuration production && ng run project-name:server
- echo Archiving to deployment.zip
- node archive.js
post_build:
commands:
- echo build process finished, we should uplload to S3 now
artifacts:
files:
- '**/*'
base-directory: 'projectname-ng/dist'
我的运行环境。
在检查日志时,我发现节点14.19已安装,但至少需要14.20。
2022-11-18T14:57:33.532+05:30 Node.js version v14.19.2 detected.
The Angular CLI requires a minimum Node.js version of either v14.20, v16.13 or v18.10.
当我手动将其更改为14.20时,它表示此错误。
YAML_FILE_ERROR Message: Unknown runtime version named '14.20' of nodejs.
再说一次,这都是突然发生的。它在今天之前就起作用了。
发布于 2022-11-18 12:39:51
也许今天最新版本的角15是介绍和安装全球版本的角安装15,这可能是造成问题。我完全不确定。
但是,我设法通过在buildspec上提到16.x
版本并将映像构建到aws/codebuild/standard:6.0
来修复它。之后,我从管道中释放当前的更改。已经修好了。建立成功。如果在npm install
期间看到错误,请尝试删除package.lock.json并再次运行。
根据aws代码构建用户指南,如果使用节点版本16.x,那么我们必须使用BuildImage6.0。
希望能帮上忙。
https://stackoverflow.com/questions/74488369
复制相似问题