By using AWS re:Post, you agree to the Terms of Use

Can't install Ruby on CodeBuild


Hi, It seems that whatever I do I can't get CodeBuild to build my Ruby project. I need Ruby version 2.7.4 so as always I added .ruby-version file in the root folder of my app with ruby-2.7.4 but the build fails with error:

rbenv: version `ruby-2.7.4' is not installed 

I set ruby-2.6 in my .ruby-version but the build fails again with error

rbenv: version `ruby-2.6' is not installed 

I tried installing proper Ruby version at build so I set this command:

      - rbenv install 2.7.4

but I get the same error:

rbenv: version `ruby-2.6' is not installed

What am I doing wrong? What am I missing?

  • Which build image are you using? I was able to do this with aws/codebuild/amazonlinux2-x86_64-standard:3.0

  • I am using aws/codebuild/amazonlinux2-x86_64-standard:3.0 When I set ruby: 2.7.4 I get an error

    Phase context status code: YAML_FILE_ERROR Message: Unknown runtime version named '2.7.4' of ruby. This build image has the following versions: 2.6, 2.7