简体   繁体   English

rails 2.3.4中的Gem依赖性错误

[英]Gem dependency error in rails 2.3.4

HI, i am working in Rails .. my gem list is 嗨,我在Rails工作..我的宝石列表是

*** LOCAL GEMS ***

   abstract (1.0.0)
 actionmailer (3.0.4, 3.0.3, 2.3.11, 2.3.10, 2.3.8, 2.3.4, 2.3.2)
 actionpack (3.0.4, 3.0.3, 2.3.11, 2.3.10, 2.3.8, 2.3.4, 2.3.2)
activemodel (3.0.4, 3.0.3)
  activerecord (3.0.4, 3.0.3, 2.3.11, 2.3.10, 2.3.8, 2.3.4)
  activeresource (3.0.4, 3.0.3, 2.3.11, 2.3.10, 2.3.8, 2.3.4)
  activesupport (3.0.4, 3.0.3, 2.3.11, 2.3.10, 2.3.8, 2.3.4, 2.3.2)
  acts-as-taggable-on (2.0.6)
    acts_as_ferret (0.4.8, 0.4.2)
 acts_as_versioned (0.6.0)
 after_commit (1.0.8, 1.0.7)
 annotate (2.4.0)
  annotate-models (1.0.4)
 arel (2.0.8, 2.0.7, 2.0.6)
  autotest-rails (4.1.0)
 babosa (0.2.1, 0.2.0)
 bcrypt-ruby (2.1.4, 2.1.3, 2.1.2)
  builder (3.0.0, 2.1.2)
     bundler (1.0.10, 1.0.7)
     cgi_multipart_eof_fix (2.5.0)
    ClothRed (0.4.1)
      coderay (0.9.6, 0.9.5, 0.9.3, 0.8.357)
     configuration (1.1.0)
     cucumber (0.8.5)
      daemons (1.1.0, 1.0.10)
    delayed_job (2.1.2, 2.0.5, 2.0.4, 2.0.3)
     devise (1.1.5)
        diff-lcs (1.1.2)
     docsplit (0.5.0)
     echoe (4.3.1, 3.0.2)
    erubis (2.6.6)
    factory_girl (1.3.2, 1.2.3)
    fastthread (1.0.7, 1.0.1)
      ferret (0.11.6)
      friendly_id (3.2.0)
       gem_plugin (0.2.3)
       gemcutter (0.6.1)
      gherkin (2.2.0, 2.1.5)
       gm (1.0.4)
  haml (3.0.25)
     highline (1.6.1, 1.5.0)
   hoe (2.6.1, 1.12.2)
    hpricot (0.8.3, 0.8.2, 0.8.1)
    htmldoc (0.2.3, 0.2.1)
     i18n (0.5.0)
   io-reactor (1.0.4)
    jquery-rails (0.2.6)
   jslint_on_rails (1.0.5)
 json_pure (1.4.6, 1.4.3)
    launchy (0.3.7, 0.3.5)
   mail (2.2.15, 2.2.14, 2.2.13)
    memcache-client (1.8.5)
   memcached (1.0.6)
  mime-types (1.16)
    mini_magick (1.3.2, 1.2.3)
   mocha (0.9.10)
   mongrel (1.1.5)
    mysql (2.8.1)
     mysql2 (0.2.6)
    net-ldap (0.1.1)
    newgem (1.5.3, 1.3.0)
     oauth (0.4.4, 0.4.1, 0.3.6, 0.3.2)
   oauth-plugin (0.3.14)
   paperclip (2.3.8)
     passenger (2.2.15, 2.2.5, 2.1.2, 2.0.6)
   pg (0.9.0, 0.8.0)
  polyglot (0.3.1)
 prawn (0.8.4)
    prawn-core (0.8.4)
  prawn-format (0.2.3)
 prawn-js (0.7.1)
   prawn-layout (0.8.4)
   prawn-security (0.8.4)
  rack (1.2.1, 1.1.0, 1.0.1, 0.9.1)
   rack-mount (0.6.13)
  rack-test (0.5.7)
  rails (3.0.4, 2.3.11, 2.3.8, 2.3.4)
   railties (3.0.4, 3.0.3)
      rake (0.8.7, 0.8.4, 0.8.1)
  RedCloth (4.2.3, 4.1.1)
    riddle (1.2.2, 1.2.1, 1.0.12)
    rspec (1.3.0)
     rspec-rails (1.3.2)
     rubigen (1.5.5, 1.5.2)
     ruby-hmac (0.4.0, 0.3.2)
      Ruby-MemCache (0.0.1)
     rubyforge (2.0.4, 1.0.3, 1.0.1)
     rubygems-update (1.4.2)
    slim_scrooge (1.0.11)
   sqlite3-ruby (1.3.2, 1.3.1, 1.2.5, 1.2.4)
    subexec (0.0.4)
       syntax (1.0.0)
      term-ansicolor (1.0.5)
     thinking-sphinx (1.4.1, 1.4.0, 1.3.18)
    thor (0.14.6)
 treetop (1.4.9)
  trollop (1.16.2)
    ts-delayed-delta (1.1.1, 1.1.0)
        tzinfo (0.3.24, 0.3.23)
     warden (1.0.3, 1.0.2)
web-app-theme (0.6.3)
   will_paginate (3.0.pre2)
     yaml_db (0.2.0)
       ZenTest (4.3.3)

I have the above gem list 我有上面的宝石清单

When i run my application 当我运行我的应用程序

  script/server
  => Booting Mongrel
 => Rails 2.3.4 application starting on http://0.0.0.0:3000
 /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:119:in `requirement': undefined local variable or method `version_requirements' for #<Rails::GemDependency:0xb7181c78> (NameError)
from /usr/local/lib/site_ruby/1.8/rubygems.rb:254:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:1204:in `gem'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:73:in `add_load_paths'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:301:in `add_gem_load_paths'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:301:in `each'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:301:in `add_gem_load_paths'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:132:in `process'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
from /home/user/application/config/environment.rb:19
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/commands/server.rb:84
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from script/server:3

I am getting the above error .. 我收到上述错误..

How to resolve this ?? 怎么解决这个?

This is happening because you installed RubyGems that is too new for your version of Rails. 发生这种情况是因为您安装的RubyGems对于您的Rails版本来说太新了。 Either downgrade (and re-run update_rubygems) or upgrade Rails to 2.3.11. 降级(并重新运行update_rubygems)或将Rails升级到2.3.11。

The solution is fairly simple. 解决方案非常简单。 Just run the following commands to go back to the previous version of rubygems and you should be fine: 只需运行以下命令即可返回上一版本的rubygems,你应该没问题:

$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems

This could be because you have rails 3 installed but are trying to run a rails 2.3.4 app. 这可能是因为你安装了rails 3但是正在尝试运行rails 2.3.4 app。 I've had this problem before and the solution was to remove rails 3 because this dependency is one of rails 3, not 2.3.4 我以前遇到过这个问题,解决方法是删除rails 3,因为这种依赖是rails 3之一,而不是2.3.4

Your gem list (the one you get on the command "gem list") is list of installed gems. 您的宝石列表(您在命令“gem list”上获得的宝石列表)是已安装宝石的列表。

That's not the list of gems used by your application -> those are in the Gemfile. 这不是您的应用程序使用的宝石列表 - >那些在Gemfile中。

Things you might try or have tried: 您可能尝试或尝试过的事情:

  • update_rubygems update_rubygems
  • bundle install 捆绑安装

(see also https://gist.github.com/807008 ) (另见https://gist.github.com/807008

OK I just upgraded a Rails app from 2.3.4 to 2.3.14 and got the same error. 好吧我刚刚将一个Rails应用程序从2.3.4升级到2.3.14并得到了同样的错误。

However I had already downgraded rubygems to 1.3.5 (as recommended in another answer) to get around a similar error after upgrading the core Ruby package 但是我已经将rubygems降级到1.3.5(正如另一个答案中的建议),以便在升级核心Ruby包之后解决类似的错误

So i took a punt and upgraded to the latest version: 所以我拿了一个平底船并升级到最新版本:

sudo gem update --system

This gave me version 1.8.24 这给了我1.8.24版

and everything started working again. 一切都开始了。 shrug

Perhaps that throws the issue into a somewhat different light. 也许这会把问题抛到一个不同的角度。

I know there's already an answer for this, but when I was running an older rails, I specified script/server webrick after having the same problem and this worked. 我知道已经有了这个问题的答案,但是当我运行一个较旧的rails时,我在遇到同样的问题后指定了脚本/服务器webrick,这很有用。 This may not be ideal for production, however, and I recommend upgrading as mentioned in the other answer. 但是,这可能不适合生产,我建议升级,如其他答案中所述。

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

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