0

my ruby -v is ruby 2.0.0p648 (2015-12-16) [x86_64-linux] on my Python EB instance.

I need Ruby 2.2 to install sass.

How can I get ruby 2.2?

My .ebextensions has this:

packages:
  yum:
    ruby-devel: []
  rubygems:
    sass: []

But I still am only getting an old version of Ruby.

Rory Byrne
  • 923
  • 1
  • 12
  • 22

3 Answers3

1

For anyone that have the same question and haven't yet resolved it.

packages:
    yum:
        ruby22: []
        ruby22-devel: []
container_commands:
    01-set_ruby22:
        command: "alternatives --set ruby /usr/bin/ruby2.2"
    02-install_sass:
        command: "gem install sass"

First, via yum we install the latest supported version of Ruby and Ruby Devel (I prefer 2.4, but the question is for 2.2), after, via container_commands, we set the current ruby version to the latest one, and later we install sass

I prefix the mumbers because it tells to container commands the order in which I need to run each command.

Néstor
  • 570
  • 2
  • 8
  • 22
0

Not sure if this will work but can you try adding the ruby main version in the .ebextensions file? I would recommend the latest version of ruby you can use, as of now it's 2.6 so perhaps:

packages:
  yum:
    ruby26-devel: []
  rubygems:
    sass: []

However, if this alone doesn't work, you will probably need to use the CLI, for more ideas see this answer

lacostenycoder
  • 10,623
  • 4
  • 31
  • 48
  • I'm trying this, but for some reason ruby 2.0 is still being installed, meaning that both ruby 2.0 and ruby 2.2 are installed at the same time. Running `ruby -v` still outputs `ruby2.0.0`. – Rory Byrne May 18 '19 at 10:37
  • No, I'm using `yum` to manage packages on Elastic Beanstalk. Can I use RVM on Elastic Beanstalk? – Rory Byrne May 19 '19 at 09:57
0

ruby26-devel is probably not available in amazon linux repo yet. Try install ruby22-devel and run alternatives --set ruby /usr/bin/ruby2.2. You can run the commands in ebextensions

kxyjm
  • 13
  • 1
  • 3