Can't install Ruby on CodeBuild

0

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:

pre_build:
    commands:
      - 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
    
jedrek
asked 2 years ago101 views
No Answers

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