0

I need nodejs runtime in AWS CodeBuild. I have tried substituting the v10.16.0 which comes packaged with codebuild with v11.14.0 but when I check node -v output it still shows as 10.16.0.

Can anyone help me fix this ?

TIA.

ZeroGraviti
  • 1,047
  • 2
  • 12
  • 28
  • How do you check nodejs version? Provide your `buildspec.yml` or something the same. – hoangdv Sep 20 '19 at 01:49
  • node -v is what I am going with. But it always takes what comes pre installed in the aws managed image which is 10.16.0. My buildspec uses a relative path to node.exe but that isn't working. The path is relative to $CODEBUILD_SRC_DIR since I have manually (curl approach) downloaded and unzipped nodejs 11.14.0 to the filesystem location with the $CODEBUILD_SRC_DIR as root location. – ZeroGraviti Sep 20 '19 at 14:44
  • Do you define `Runtime Version` in your `buildspec.yml`? like https://github.com/dvohra/node-js/blob/master/buildspec.yml – hoangdv Sep 20 '19 at 15:36
  • Currently I am using a runtime-version of "java:openjdk8". My build stack is a combination of nodejs+ant+jdk. I have tried both options - with/without explicit nodejs runtime declaration in the buildspec but neither has helped. I am contemplating a chocolatey install of nvm and see what options I have from there. – ZeroGraviti Sep 20 '19 at 15:40
  • I think Codebuild just supports runtime in the list https://docs.aws.amazon.com/en_us/codebuild/latest/userguide/build-env-ref-available.html . You can try use a custom Docker image instead of the image what managed by Codebuild. – hoangdv Sep 20 '19 at 15:51
  • I have tried my custom docker image on CodeBuild. Just wont work even though I have tested these images successfully on Windows 2016 and Windows 2019 DataCenter edition. :| The only option I have right now is CodeBuild FWIW. – ZeroGraviti Sep 20 '19 at 17:50

1 Answers1

-1

I fixed this by curldownloading nodejs 11.14.0 from within the buildspec and overriding the default environment variable for PATH.

ZeroGraviti
  • 1,047
  • 2
  • 12
  • 28