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
已提問 2 年前檢視次數 101 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南