Friday, October 23, 2015

Incompatible bundler versions

Am currently doing a spike on upgrading a sample Rails 2.3 hello world application to Rails 3.0
The first step was to change the rails gem version in Gemfile and the error was :


tl;dr
  • Older version of bundler is needed
    •  $ gem install bundler -v '~> 1.0.0'
    •  


  •  
  • Force rubygems to use this version of bundler
    • bundle _1.0.22_ install 
Note: The revision number of the gem is different from what we wanted to install. This is ok as revision numbers are generally bug fixes. Just remember to force use the version that is available.

Behind the scenes:
Gemfile in Rails helps in recording the exact version of the gems that we want to use for our application. Bundler ensures this while avoiding dependency hell. "bundle exec" executes commands in the context of the current bundle and conflicting pre-installed gems will not be used from your system.
But bundler is installed as a gem too and can have version incompatibility issue like we saw in the error above. One can then install the required version and force rubygems to use a particular version without affecting the bundler being used across other Rails projects (if you have any) on the same system. Fortify your applications against each other on your system!

No comments:

Post a Comment