Closed bilegjargal-jargalsaikhan closed 9 months ago
I use cdk to deploy, so I changed my script as per below and it is now running on 18.17.1
So I added 'n 18' & 'npm i npm@latest -g' to phases, initial, command, also I am using the latest image
synth: new ShellStep('Synth', {
input: CodePipelineSource.connection('myapp', 'master', { connectionArn: props.config.accounts.mgnt.gitConnection }),
commands: [
'npm ci',
'npm run build',
'npx cdk synth',
],
installCommands: [
'npm i -g npm && npm ci'
],
}),
synthCodeBuildDefaults: {
partialBuildSpec : BuildSpec.fromObject({
phases: {
install: {
commands: [
'n 18',
'npm i npm@latest -g',
]
}
}
}),
buildEnvironment: {
privileged: true,
//computeType: cdk.aws_codebuild.ComputeType.LARGE,
buildImage: LinuxBuildImage.fromCodeBuildImageId('aws/codebuild/amazonlinux2-x86_64-standard:5.0')
},
},
});
here is an alternate way, update your buildspec:
phases:
install:
runtime-versions:
python: 3.x #optional
commands:
- echo "Installing NVM and Node.js 18.17.0..."
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
- . $HOME/.nvm/nvm.sh && nvm install 18.17.0
- node -v
- npm -v
# ... other installation commands...
CodeBuild released an update for node 18 in the AL:5.0 image and Ubuntu 7.0 (https://github.com/aws/aws-codebuild-docker-images/pull/689).
I have some node packages that don't support on the current version of the codebuild standard:7 image which has the node version
18.16.1
so I needed to update the node version to 18.17.0Issue #668
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.