缺少导轨宝石 [英] Missing Rails Gem

查看:116
本文介绍了缺少导轨宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题已经在这个网站上被多次询问,但是在深入了解其他答案之后,我仍然对如何解决这个问题抱有空白。



我只是从生产服务器上拖出一个Rails应用程序的副本,并且出现以下错误:


缺少Rails 2.3.4 gem。请
gem install -v = 2.3.4 rails ,更新
您的RAILS_GEM_VERSION设置为
config / environment.rb for Rails
版本,或
评论RAILS_GEM_VERSION使用
安装最新版本。


rails 2.3.4在我的宝石列表中:

  ***本地GEMS *** 

actionmailer(2.3.8,2.3.5,2.3.4,2.2.2,1.3.6)
actionpack(2.3.8,2.3.5,2.3.4,2.2.2,1.13.6)
actionwebservice(1.2.6)
activerecord(2.3.8,2.3.5,2.3.4,2.2.2,1.15.6)
主动资源(2.3.8,2.3.5,2.3 .4,2.2.2)
有效支持(2.3.8,2.3.5,2.3.4,2.2.2,1.4.4)
acts_as_ferret(0.4.3)
authlogic(2.1 .6)
capistrano(2.5.2)
cgi_multipart_eof_fix(2.5.0)
守护进程(1.0.10)
dnssd(0.6.0)
fastercsv(1.5 .4)
fastthread(1.0.1)
fcgi(0.8.7)
雪貂(0.11.6)
gem_plugin(0.2.3)
gemcutter(0.6 .1)
google-spreadsheet-ruby(0。 1.2)
highline(1.5.0)
hpricot(0.6.164)
libxml-ruby(1.1.2)
mongrel(1.1.5)
mysql 2.8.1)
needle(1.3.0)
net-scp(1.0.1)
net-sftp(2.0.1,1.1.1)
net-ssh( 2.0.4,1.1.4)
net-ssh-gateway(1.0.0)
nokogiri(1.4.4)
oauth(0.4.4)
包(0.1。 (0.8.4)
对虾(0.8.4)
对虾(0.8.4)
对虾快(png)(0.2.3)
对虾分布(0.8.4)
prawn-security(0.8.4)
rack(1.2.1,1.1.0,1.0.1)
rails(2.3.8,2.3.5,2.3.4,2.2。 2,1.2.6)
rake(0.8.3)
RedCloth(4.1.1)
rmagick(2.13.1)
roo(1.9.3)
ruby-ole(1.2.11.1)
ruby​​-openid(2.1.2)
ruby​​-yadis(0.3.4)
ruby​​node(0.1.5)
ruby​​zip(0.9。 4)
电子表格(0.6.5.0)
sqlite3-ruby(1.2.4)
termios(0.9.4)
xmpp4r(0.4)

gem list -d rails 看起来像这样:

  ***本地GEMS *** 

rails(2.3.8,2.3.5,2.3.4,2.2。 2,1.2.6)
作者:Da vid Heinemeier Hansson
Rubyforge:http://rubyforge.org/projects/rails
主页:http://www.rubyonrails.org
安装于(2.3.8):/ Library / Ruby / Gems / 1.8
(2.3.5):/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
(2.3.4):/ Library / Ruby / Gems / 1.8
(2.2.2):/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
(1.2.6) :/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

带有模板引擎,控制流层,
的Web应用程序框架和ORM。

现在,这里是我丢失的地方: environment.rb 我有这条线来选择rails 2.3.4。



RAILS_GEM_VERSION ='2.3.4'除非定义? RAILS_GEM_VERSION



如果我将此行更改为:

RAILS_GEM_VERSION ='2.3.8'除非定义? RAILS_GEM_VERSION



错误消失。我知道有不同位置安装的导轨版本,但有问题的两个版本安装在相同的位置。为什么2.3.8不会引发错误,而2.3.4呢?



我该如何解决这个问题?



注意:脚本/控制台似乎可以正常工作注意:我正在Passenger 上运行 在2.3.4之下...但是应用程序仍然在Web浏览器中失败。
$ b $ h1> UPDATE

好的,所以我检查了 httpd.conf 中的 PassengerRuby 指令,它是 / usr / local / bin / ruby​​ ,而 ruby​​ 产生 / usr / bin / ruby​​ 。我改变了指令为 / usr / bin / ruby​​



这解决了web浏览器的问题, / console失败,出现同样的错误:


缺少Rails 2.3.4 gem。请
gem install -v = 2.3.4 rails ,更新
您的RAILS_GEM_VERSION设置为
config / environment.rb for Rails
版本,或
评论RAILS_GEM_VERSION使用
安装最新版本。


现在,我可以在Web浏览器中查看项目。但是我不能使用任何rails脚本,并且 rake db:migrate 失败,并出现以下错误:


/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in
report_activate_error':Could not

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/找到RubyGem rake(> = 0)
(Gem :: LoadError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems中的rubygems.rb:261:in
activate'。 rb:68:在`gem'中从/ usr / bin / rake:18


解决方案

您的Apache配置中的PassengerRuby指令是否与您从哪个ruby获得的输出相匹配?如果没有,那么你的乘客不会在同一个地方寻找宝石

I know this question has been asked multiple times on this site, but after digging through other answers, I am still coming up blank on how to resolve this.

I just pulled copy of a rails app from a production server, and I get the following error:

Missing the Rails 2.3.4 gem. Please gem install -v=2.3.4 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

rails 2.3.4 is in my gem list:

*** LOCAL GEMS ***

actionmailer (2.3.8, 2.3.5, 2.3.4, 2.2.2, 1.3.6)
actionpack (2.3.8, 2.3.5, 2.3.4, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.8, 2.3.5, 2.3.4, 2.2.2, 1.15.6)
activeresource (2.3.8, 2.3.5, 2.3.4, 2.2.2)
activesupport (2.3.8, 2.3.5, 2.3.4, 2.2.2, 1.4.4)
acts_as_ferret (0.4.3)
authlogic (2.1.6)
capistrano (2.5.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
dnssd (0.6.0)
fastercsv (1.5.4)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
gemcutter (0.6.1)
google-spreadsheet-ruby (0.1.2)
highline (1.5.0)
hpricot (0.6.164)
libxml-ruby (1.1.2)
mongrel (1.1.5)
mysql (2.8.1)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.1)
net-ssh (2.0.4, 1.1.4)
net-ssh-gateway (1.0.0)
nokogiri (1.4.4)
oauth (0.4.4)
packet (0.1.15)
prawn (0.8.4)
prawn-core (0.8.4)
prawn-fast-png (0.2.3)
prawn-layout (0.8.4)
prawn-security (0.8.4)
rack (1.2.1, 1.1.0, 1.0.1)
rails (2.3.8, 2.3.5, 2.3.4, 2.2.2, 1.2.6)
rake (0.8.3)
RedCloth (4.1.1)
rmagick (2.13.1)
roo (1.9.3)
ruby-ole (1.2.11.1)
ruby-openid (2.1.2)
ruby-yadis (0.3.4)
rubynode (0.1.5)
rubyzip (0.9.4)
spreadsheet (0.6.5.0)
sqlite3-ruby (1.2.4)
termios (0.9.4)
xmpp4r (0.4)

And gem list -d rails looks like this:

*** LOCAL GEMS ***

rails (2.3.8, 2.3.5, 2.3.4, 2.2.2, 1.2.6)
    Author: David Heinemeier Hansson
    Rubyforge: http://rubyforge.org/projects/rails
    Homepage: http://www.rubyonrails.org
    Installed at (2.3.8): /Library/Ruby/Gems/1.8
                 (2.3.5): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
                 (2.3.4): /Library/Ruby/Gems/1.8
                 (2.2.2): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
                 (1.2.6): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

    Web-application framework with template engine, control-flow layer,
    and ORM.

Now, here is where I am lost: in environment.rb I have this line to select rails 2.3.4.

RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION

If I change this line to:

RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION

The error goes away. I know there are versions of rails installed in different locations, but the two versions in question are installed in the same location. Why would 2.3.8 not raise an error, while 2.3.4 does?

How can I resolve this issue?

NOTE: I am running on Passenger

ALSO, OF NOTE: script/console appears to work under 2.3.4... but the app still fails in a web browser.

UPDATE

Okay, so I checked the PassengerRuby directive in httpd.conf and it was /usr/local/bin/ruby while which ruby produced /usr/bin/ruby. I changed the directive to /usr/bin/ruby.

This solved the web browser issue, however now script/console is failing with the same error:

Missing the Rails 2.3.4 gem. Please gem install -v=2.3.4 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

So now, I can view the project fine in a web browser. But I cannot use any rails scripts, and rake db:migrate fails with the following error:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in report_activate_error': Could not find RubyGem rake (>= 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/rake:18

解决方案

Does the PassengerRuby directive in your Apache config match the output you get from "which ruby"? If not then your passenger isn't looking for gems in the same place you are

这篇关于缺少导轨宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆