Jeff Caros
Jeff Caros

Reputation: 989

Installed Ruby 2.0.0, but an error tells me I have 1.9.3 installed

I just cloned my Rails app onto my new computer. Ruby 2.0.0 seemed to install with no issue, but when I run sudo bundle install inside my app, I get an error telling me I have Ruby 1.9.3 installed:

$ sudo bundle install
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0

and bundle install returns this:

$ bundle install
/home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
from /home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/bundle:7:in `<main>'

I don't understand why I would have 1.9.3 installed. I used the command rvm install 2.0.0 to install Ruby.

Also, ruby -v returns:

ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux]

What's going on?

Output of rvm list

$ rvm list

rvm rubies

=* ruby-2.0.0-p643 [ x86_64 ]

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

Upvotes: 1

Views: 317

Answers (1)

Dylan Markow
Dylan Markow

Reputation: 124419

Because you're using rvm, you shouldn't ever need to use sudo on any of your commands. Using sudo is likely running the globally installed 1.9.3 version.

If you just installed Ruby 2.0.0 and haven't done anything else, then you most likely need to install bundler first before using it:

gem install bundler

Once you've done that, bundle install (without sudo) should work fine.

Upvotes: 1

Related Questions