Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is 'bundle update' installing ancient gems?

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!

like image 679
Jo P Avatar asked May 23 '11 21:05

Jo P


People also ask

How do I undo a gem update?

Use git checkout -- Gemfile. lock to revert to your old Gemfile. lock if you've accidentally updated it too.

Where are bundle gems installed?

In addition, the user deploying the application may not have permission to install gems to the system, or the web server may not have permission to read them. As a result, bundle install --deployment installs gems to the vendor/bundle directory in the application. This may be overridden using the --path option.

What is the goal of running bundle install?

Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. Bundler is an exit from dependency hell, and ensures that the gems you need are present in development, staging, and production. Starting work on a project is as simple as bundle install .

How do I install bundles to install missing gems?

Install gemsIn the invoked popup, start typing bundler, select bundle install and press Enter . Select Tools | Bundler | Install from the main menu. Open the Gemfile, place the caret at any highlighted gem missing in the project SDK and press Alt+Enter . Select Install missing gems using 'bundler' and press Enter .


1 Answers

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).

like image 194
Jo P Avatar answered Oct 01 '22 01:10

Jo P