Cannot install Ruby Gem Addressable v2.4.0

630 views Asked by At

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

There are 2 answers

4
max pleaner On

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.

0
Keith Bennett On

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.