Gem/Bundler load error: can't activate…already

2019-02-16 21:08发布

问题:

I ran bundle update to update my gems. now I get this when I try to start up the local, development server. Anyone know how to fix?

hostname:myapp username$ rails s
/Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:238:in `activate': can't activate i18n (~> 0.4.1, runtime) for ["mail-2.2.10", "actionmailer-3.0.3", "rails-3.0.3"], already activated i18n-0.5.0 for ["activemodel-3.0.3", "actionpack-3.0.3", "rails-3.0.3"] (Gem::LoadError)
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:254:in `block in activate'
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:253:in `each'
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:253:in `activate'
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:254:in `block in activate'
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:253:in `each'
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:253:in `activate'
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:254:in `block in activate'
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:253:in `each'
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:253:in `activate'
    from /Users/username/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:1065:in `gem'
    from /Users/username/.rvm/gems/ruby-1.9.2-p0@rails3/bin/rails:18:in `<main>'

回答1:

You need to uninstall the i18n-0.5.0 gem. That fixed it for me...



回答2:

This worked for me too: Instead of gem uninstall i18n your best bet is gem uninstall i18n -v=0.5.0

Here's why it matters: If you don't specify the version you are uninstalling, it will ask you if you want to uninstall a specific version or all of them. This isn't actually a problem, inherently, but I made the mistake of uninstalling all of them. No need to do that.

To get out of the bind I was in at that point (no i18n at all!) I did gem install i18n -v0.4.2 and all was well again.