如何修复下面的错误“但您的Gemfile需要activesupport 3.0.0”

时间:2011-01-15 19:55:59

标签: ruby-on-rails rubygems

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

2 个答案:

答案 0 :(得分:2)

如错误所述,您是否考虑使用bundle exec? :)

通过bundle exec运行命令,以确保可用的Gems版本正是Gemfile所说的。

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

答案 1 :(得分:0)

删除gemfile中特定版本的gem,并让gem名称单独使用。