【问题标题】:How can I fix error below "but your Gemfile requires activesupport 3.0.0"如何修复“但您的 Gemfile 需要 activesupport 3.0.0”下方的错误
【发布时间】:2011-01-15 19:55:58
【问题描述】:

Gem::LoadError - 您已经激活了 activesupport 3.0.3,但您的 Gemfile 需要 activesupport 3.0.0

/usr/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/runtime.rb:27:in `setup': You have already activated activesupport 3.0.3, but your Gemfile requires activesupport 3.0.0. Consider using bundle exec. (Gem::LoadError)
   from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/spec_set.rb:12:in `each'
   from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/spec_set.rb:12:in `each'
   from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler/runtime.rb:17:in `setup'
   from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.2/lib/bundler.rb:100:in `setup'
   from /home/maiordes/rails_apps/maiordesconto/config/boot.rb:8
   from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
   from /home/maiordes/rails_apps/maiordesconto/config/application.rb:1
   from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
   from /home/maiordes/rails_apps/maiordesconto/config/environment.rb:2
   from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
   from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
   from /home/maiordes/rails_apps/maiordesconto/daemons/ticket_handler.rb:6

【问题讨论】:

    标签: ruby-on-rails rubygems


    【解决方案1】:

    就像错误所说的那样,您是否考虑过使用bundle exec? :)

    通过bundle exec 运行命令,以确保可用的 Gem 版本与 Gemfile 所说的完全一致。

    例如: bundle exec rails ... bundle exec rake ...

    【讨论】:

    • 始终捆绑 Exec - 每次 - 它都会为您省去很多麻烦。否则切换到独角兽服务器。
    • 即使我 确实 使用 bundle exec... 这也会发生在我身上,这使得这个错误特别令人讨厌。看到这条评论:stackoverflow.com/a/8187636/47185
    【解决方案2】:

    去掉gemfile中gem的具体版本,单独保留gem名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      • 2011-05-27
      • 2013-10-20
      • 1970-01-01
      • 2013-11-03
      • 2011-04-08
      相关资源
      最近更新 更多