Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundler: You are trying to install in deployment mode after changing your Gemfile

I'm pretty new to bundler and capistrano, and I'm trying to use them together. When I try to deploy, I get the message:

You are trying to install in deployment mode after changing your Gemfile. Run `bundle install' elsewhere and add the updated Gemfile.lock to version control.

I don't know how to satisfy the system that's complaining, and I don't understand why the complaint is coming up because I read in the doc:

If a Gemfile.lock does exist, and you have updated your Gemfile(5), bundler will use the dependencies in the Gemfile.lock for all gems that you did not update, but will re-resolve the dependencies of gems that you did update. You can find more information about this update process below under CONSERVATIVE UPDATING.

I interpret that to mean that the Bundler can handle the fact that my Gemfile is not whatever it expected. Any help?

Specs: Ruby 1.9.3, Rails 3.2.3, Capistrano 2.12.0, Bundler 1.1.4, Windows 7, deploying to a Posix machine.

Edit: My Gemfile includes logic blocks like the following:

unless RbConfig::CONFIG['host_os'] === 'mingw32'   # gem 'a' ... end 
like image 459
JellicleCat Avatar asked Jul 16 '12 22:07

JellicleCat


People also ask

How do I install everything in Gemfile?

run the command bundle install in your shell, once you have your Gemfile created. This command will look your Gemfile and install the relevant Gems on the indicated versions. The Gemfiles are installed because in your Gemfile you are pointing out the source where the gems can be downloaded from.

How do I change my Gemfile version?

Process: install the gem generically, looking up your target version on rubygems.org, then update and version your Gemfile. the install command is in the right-hand column. then you can: gem install gem_name -v 1.5.


2 Answers

The error message you're getting regarding Gemfile.lock may be because your Gemfile and Gemfile.lock don't agree with each other. It sounds like you've changed something in your Gemfile since you last ran bundle install (or update). When you bundle install, it updates your Gemfile.lock with any changes you've made to Gemfile.

Make sure you run bundle install locally, and check-in to source control your newly updated Gemfile.lock after that. Then try deploying.

Edit: As recognised in the comments, a conditional in the Gemfile resulted in a valid Gemfile.lock on one platform, invalid on another. Providing a :platform flag for these platform-dependent gems in the Gemfile should solve the asymmetry.

like image 172
Edd Morgan Avatar answered Sep 19 '22 10:09

Edd Morgan


vi .bundle/config

change the BUNDLE_FROZEN option from '1' to '0'

do "bundle install"


OR

run "bundle config"

see if the "frozen" value is true set it to false

bundle config frozen false

like image 36
Gaurav Ingalkar Avatar answered Sep 22 '22 10:09

Gaurav Ingalkar