简体   繁体   中英

Rails installation - Ruby version mismatch

I was installing rails on my machine with RVM and Ruby 2.0.0 specified in Gemfile. When I run bundle install, I get the following error:

Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0

When I use ruby -v , I see

ruby 2.0.0p353 (2013-11-22 revision 43784) [i686-linux]

Does anyone know how to fix this?

It could be that your bundle command is not from the same Ruby as ruby is. Always check:

which ruby
which bundle
which gem

These might be completely different.

These can get out of sync if you install bundler on your system Ruby and then install something like rbenv or rvm on top of that without it.

Remove ruby from your Gemfile. Try

$ rvm list

rvm rubies

=* ruby-1.9.3-p286 [ x86_64 ]
   ruby-2.0.0-p195 [ x86_64 ]

This o/p says that 1.9.3 is the default. This displays all the ruby versions present in your system. You can pick any of the versions which you want to use

$ rvm use version --default .

Now

$ruby -v

This must match with the version you have set as default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM