简体   繁体   English

安装RVM后Rails 2.3.8应用程序无法启动

[英]Rails 2.3.8 application not booting after installing RVM

After installing Rails 3, RVM and Ruby 1.9.2, I've been having trouble running this Rails 2.3.8 app. 安装Rails 3,RVM和Ruby 1.9.2之后,我一直无法运行此Rails 2.3.8应用程序。

necromancer@factory$ script/server
./script/../config/boot.rb:5: uninitialized constant Rails (NameError)
 from script/server:2:in `require'
 from script/server:2

After running gem which rails , I got the following path: 在运行gem which rails ,我得到了以下路径:

/Users/necromancer/.rvm/gems/ruby-1.8.7-p302/gems/railties-3.0.0/lib/rails.rb

So I uninstalled railties-3.0.0 and ran gem install rails Now, gem which rails throws the following error: 所以我卸载了railties-3.0.0并运行了gem install rails现在, gem which rails抛出以下错误:

ERROR:  Can't find ruby library file or shared library rails

I also tried uninstalling rails 2.3.8 and running bundle install within my app. 我还尝试了卸载Rails 2.3.8并在我的应用程序中运行bundle install Then I tried to gem uninstall rails and gem install rails -v=2.3.8 , and while the rails binary still works, gem which rails still throws this error. 然后我尝试用gem uninstall railsgem install rails -v=2.3.8 ,并且在rails二进制文件仍然有效的同时, gem which rails仍然会抛出此错误。 I think it may be the source of my problem...how do I get this to point to rails 2.3.8 on my rvm 1.8.7 gemset?? 我认为这可能是我问题的根源...我该如何将其指向rvm 1.8.7 gemset上的rails 2.3.8?

It's because you have conflict with Rails 2 and Rails 3. 这是因为您与Rails 2和Rails 3冲突。

You have 2 choices: 您有2个选择:

  • Use bundler in your rails 2.3 app 在Rails 2.3应用中使用捆绑程序
  • Use an rvm gemset independant between your rails 2 and rails 3 application 在rails 2和rails 3应用程序之间使用独立的rvm gemset

If you are using gemsets, run rails --version and make sure it is installed. 如果使用的是宝石集,请运行rails --version并确保已安装它。 It looks like a Rails 3 vs Rails 2.x issue to me. 在我看来,这似乎是Rails 3 vs Rails 2.x的问题。

Gemsets will save your sanity if you are not using them already. 如果您还没有使用宝石,它们将节省您的理智。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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