YAML_FILE_ERROR Message: Unknown runtime version named '12' of nodejs

0

I have an Angular 8 / node express (node 10) application. I have updated it locally to Angular 10 / node 12. When I push it and it tries to deploy I get the following error:

[Container] 2020/08/31 13:46:21 Waiting for agent ping
[Container] 2020/08/31 13:46:23 Waiting for DOWNLOAD_SOURCE
[Container] 2020/08/31 13:46:24 Phase is DOWNLOAD_SOURCE
[Container] 2020/08/31 13:46:24 CODEBUILD_SRC_DIR=/codebuild/output/src553343447/src
[Container] 2020/08/31 13:46:24 YAML location is /codebuild/output/src553343447/src/buildspec.prod.yml
[Container] 2020/08/31 13:46:24 Processing environment variables
[Container] 2020/08/31 13:46:24 Selecting 'nodejs' runtime version '12' based on manual selections...
[Container] 2020/08/31 13:46:24 Phase complete: DOWNLOAD_SOURCE State: FAILED
[Container] 2020/08/31 13:46:24 Phase context status code: YAML_FILE_ERROR Message: Unknown runtime version named '12' of nodejs. This build image has the following versions: 10, 8

My .yml file had 10 which I changed to 12:

version: 0.2

phases:
install:
runtime-versions:
nodejs: 12
commands:
- npm i npm@latest
- npm install
- npm install -g @angular/cli

where do you configure what node versions the build image supports - "This build image has the following versions: 10, 8"?

baw
asked 4 years ago5661 views
2 Answers
0

You can go through https://github.com/aws/aws-codebuild-docker-images/issues/361 this I am able to solve this using the given approach.

Vatsal
answered 3 years ago
0

I came across the same issue in my CodeBuild pipeline and I can explain the frustration in finding the answer that worked for me.

According to this link (https://docs.aws.amazon.com/codebuild/latest/userguide/runtime-versions.html) it says that that Amazon Linux 2 should support NodeJs 12. But it does not give no distinction between the different version of Amazon Linux 2 images that exist.

This link (https://docs.aws.amazon.com/codebuild/latest/userguide/available-runtimes.html) cleared it up for me. I was using Amazon Linux 2 x86_84 standard:1.0, this only supports up to NodeJs 10.

The fix: Update your image to one of the following:

  • Amazon Linux 2 x86_64 standard:2.0
  • Amazon Linux 2 x86_64 standard:3.0
  • Amazon Linux 2 AArch64 standard:1.0
  • Amazon Linux 2 AArch64 standard:2.0
  • Ubuntu standard:3.0
  • Ubuntu standard:4.0
  • Ubuntu standard:5.0

Paying attention to the Linux type when switching. In my case (I was using CDK) updating the build image from codebuild.LinuxBuildImage.AMAZON_LINUX_2 to codebuild.LinuxBuildImage.AMAZON_LINUX_2_2 made the difference. I don't know what that looks like in a .yml file but I am certain there is some syntax that will enable the build image to be changed to one of the above images. Good luck and I hope this post helps anyone else struggling with this.

trayson
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions