0

I am having problems with Ruby. When I try to install addressable, I get told I need ruby 1.9.0 or higher, but as you can see from my rvm list command I run 2.3.1.

Does anyone have any tips? am I doing something wrong? I've tried running the clean up, and reinstalling but I get the same error.

Any tips you can provide would be great! Thanks!

root@server1 [/]# rvm list

rvm rubies
ruby-2.3.1 [ x86_64 ]

# Default ruby not set. Try 'rvm alias create default <ruby>'.

# => - current
# =* - current && default
#  * - default

root@server1 [/]# gem install addressable -v '2.4.0'
ERROR:  Error installing addressable:
        addressable requires Ruby version >= 1.9.0.
root@server1 [/]#

enter image description here

2 Answers2

0

First run rvm use ruby-2.3.1 then gem install addressible.

To not have to run this command first, run rvm alias create ruby-2.3.1. You may have to run bash after that to load the changes. Sometime's it's needed to either run /bin/bash --login or change the terminal preferences to login shell in order for RVM commands to work.

max pleaner
  • 26,189
  • 9
  • 66
  • 118
  • I think this may work, but only in that terminal session, because you issue the first command `rvm use ruby-2.3.1`. I don't think that changes rvm's configuration at all except for the creation of the alias. I believe this will *not* fix the problem in new shell invocations. – Keith Bennett Jun 07 '16 at 04:37
  • I tried ...rvm reset, then _rvm alias create default ruby-2.3.0_ so when I run RVM list I see **=* ruby-2.3.0 [ x86_64 ]** , but when I run ruby -v I see **ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]** – Kevin Gordon Jun 08 '16 at 01:39
  • Hey, thanks for the /bin/bash --login tip. It worked! – Kevin Gordon Jun 08 '16 at 01:45
  • I'm glad it worked. From your screenshot it seems that Ruby 2.3.0 is installed but you haven't _selected it to be used_ by running `rvm use`. By the way if you're using Ruby 2.3.0 take a look at the [safe navigation operator](http://mitrev.net/ruby/2015/11/13/the-operator-in-ruby/) – max pleaner Jun 08 '16 at 02:30
0

I think you may be using the "system" ruby. This will be obvious when you run ruby -v. It is also evidenced by the fact that your rvm list output does not list a Ruby as the "current" Ruby. So rvm will have a newer Ruby, but it will not be used.

It's possible that creating the default Ruby for rvm will result in that Ruby being loaded whenever you open a terminal.

Also, the terminal needs to be a "login shell", but if this is a problem you should see a message to that effect.

So I suggest doing the following, which should only need to be done once:

rvm default ruby-2.3.1

...then opening a new terminal and seeing if your gem command works correctly there.

Keith Bennett
  • 4,722
  • 1
  • 25
  • 35