Its all of the sudden the my aws codepipe line build project started thorowing this error. It used to work fine before.
COMMAND_EXECUTION_ERROR: Error while executing command: ng build --configuration production && ng run project-name:server. Reason: exit status 3
My buildspec
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'
My runtime environment.
While checking logs I found node 14.19 is installed but min 14.20 is needed.
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.
While I manually change it to 14.20 it says this error.
YAML_FILE_ERROR Message: Unknown runtime version named '14.20' of nodejs.
Again this is all of the sudden. It was working before today.
Maybe today latest version of Angular 15 was introduce and installing the global version of angular was installing 15. Maybe that is causing the issue. I am completely not sure.
But I have manage to fixed it by mentioning version 16.x
on buildspec and build image to aws/codebuild/standard:6.0
. After that I release the current change from pipeline. It was fixed. Build successfull. If you see error during npm install
then try delete package.lock.json and run again.
As per the aws codebuild user guide if using node version 16.x then we have to use build image 6.0.
Hope it helps.