使用 rvm 升级到 ruby 1.9.3 破坏了我的 Rails 应用程序
我已使用 rvm 使用以下命令升级了 ruby:
rvm get head
rvm install 1.9.3
rvm reload
rvm use 1.9.3 --default
现在,当我运行 Rails s 时,我收到以下错误消息:
/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
如果我运行 which ruby、gem 环境和 ruby -v,我会得到一致的输出。谁能帮助我了解我的申请出了什么问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过运行
gem installrails
?将 RVM 与 ruby gem 一起使用意味着您可以在 PATH 中包含未安装的 gem 的二进制文件(包括
rails
二进制文件)。这就是你的错误的样子。
我希望
bundle install
或gem install Rails
能够解决您的问题。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
orgem install rails
will fix your problem.您应该能够通过简单地运行以下命令来再次运行您的应用程序:
安装 Gemfile 依赖项。然后,您应该使用以下命令运行 Rails 服务器:
使用
bundle exec
非常重要,以确保 Rails 命令从适合您的应用程序的正确的 Rails gem 运行。如果您想了解更多有关此信息,Yehuda Katz 有一篇详细的博客文章:
http://yehudakatz.com/2011/ 05/30/gem-versioning-and-bundler-doing-it-right/
You should be able to get your app running again by simply running:
To install your Gemfile dependencies. Then you should run rails server with:
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/