简体   繁体   中英

upgrading to ruby 1.9.3 with rvm breaks my rails app

I have upgraded ruby using the following commands with rvm:

rvm get head
rvm install 1.9.3
rvm reload
rvm use 1.9.3 --default

Now when I run rails s I get the following error message:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/bin/rails:18

If I run which ruby, gem environment, and ruby -v I get coherent output. Could anyone help me understand what is going wrong with my application?

Have you tried running gem install rails ?

Using RVM with ruby gems means you can have binaries in your PATH (including the rails binary) for gems that are not installed.

This is what your error looks like.

I hope a bundle install or gem install rails will fix your problem.

You should be able to get your app running again by simply running:

$ bundle

To install your Gemfile dependencies. Then you should run rails server with:

$ bundle exec rails s

It's important to use bundle exec in order to ensure the rails command is running from the proper rails gem for your application.

If you'd like more info on this Yehuda Katz has a detailed blog post: http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/

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