Bundler: You are trying to install in deployment mode after changing your Gemfile Bundler: You are trying to install in deployment mode after changing your Gemfile ruby-on-rails ruby-on-rails

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


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.


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


Watch out for global Bundler config.

I had a global config on my dev environment in ~/.bundle/config that I did not have in my CI / Production environment that caused the Gemfile.lock that was generated in my dev environment to be different than the one in my CI / Production environment.

In my case I was setting github.https to true in my dev environment but had no such config in my CI / Production environment. This caused the two Gemfile.lock files to be different.