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
When using RVM as your Ruby manager you do not (and should not) use
sudo
. Sudo runs everything under theroot
account. But RVM is installed under your own user account, and thereforesudo
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: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 whatrvm
has set. You can see this by comparingruby -v
andsudo ruby -v
.To solve this, try
rvmsudo gem install bundler
. This causessudo
to use the version of ruby thatrvm
expects.Read more here: https://rvm.io/integration/sudo