Why is 'bundle update' installing ancient

2019-04-29 09:33发布

问题:

Everything was working just fine until, out of the blue, bundle update decided to 'update' to some very old versions of some gems. Any ideas? I'm baffled!

The Gemfile doesn't specify a version for the awry gems. eg.

gem 'rails'

I do...

bundle update

And(!)...

Using rails (0.9.5)

If I specify a version. eg.

gem 'rails', '~> 3.0'

Then it's ok.

Using rails (3.0.7)

Source 'http://rubygems.org'

Gem version 1.8.3, rvm version 1.6.14

Only some gems are wrong. mongoid is another. It's on 1.0.6. Thanks!

回答1:

Problem solved. It was a gem conflict. I boiled it down to...

With just these two gems:

gem 'rails'
gem 'i18n'

You get i18n 0.6.0 (the latest) but rails is on 3.0.5 (3.0.7 is current latest).

And then with just these three:

gem 'rails'
gem 'i18n'
gem 'delayed_job'

You get:

Gems included by the bundle:
  * actionmailer (0.6.1)
  * actionpack (1.4.0)
  * activerecord (1.6.0)
  * activesupport (3.0.7)
  * bundler (1.0.13)
  * daemons (1.1.3)
  * delayed_job (2.1.4)
  * i18n (0.6.0)
  * rails (0.9.5)  <-- Yikes! that brings back memories!
  * rake (0.9.0)

I've not looked deeper into how bundler's gem dependencies work yet, but that was what caused it. Interesting! And of course there's no need to include the i18n gem anyway, so removing that fixes things (or specifying gem versions).



回答2:

Try this one.

Just update your bundler, May be of any-one of the older gem is conflicting with latest one, this type of issues arises.

'gem install bundler'

and then 'bundler install'

If you find again error, then delete GEM.lock file, then run bundler install. It may resolve the issue.