skip to Main Content

I have only one ruby version installed:

$ rvm list
=* ruby-2.5.7 [ x86_64 ]

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

But any time I install jekyll or bundler I got complain of an older version.

$ sudo gem install bundler
ERROR:  Error installing bundler:
    bundler requires Ruby version >= 2.3.0.

Unable to find the reason.
Operating system: CentOS

2

Answers


  1. When using RVM as your Ruby manager you do not (and should not) use sudo. Sudo runs everything under the root account. But RVM is installed under your own user account, and therefore sudo is not needed, and will in fact circumvent RVM if used.

    So, just drop the sudo part, and if RVM is installed properly, everything should start working correctly:

    gem install bundler     # <- no sudo needed
    
    Login or Signup to reply.
  2. I bit late, but I had the same problem and couldn’t find an answer documented anywhere.
    The problem is that sudo uses a different version of ruby than what rvm has set. You can see this by comparing ruby -v and sudo ruby -v.

    To solve this, try rvmsudo gem install bundler. This causes sudo to use the version of ruby that rvm expects.

    Read more here: https://rvm.io/integration/sudo

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search