Bundler: you are trying to install in deployment mode after changing the gemfile

I am new to bundler and capistrano and I am trying to use them together. When I try to deploy, I get a message:

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

I don’t know how to satisfy the system complaining, and I don’t understand why the complaint comes because I read in the document :

If Gemfile.lock exists and you updated your Gemfile (5), the bundler will use the dependencies in Gemfile.lock for all the gems that you did not update, but will re-solve the dependencies of the gems that you updated. You can find additional information about this update process below under CONSERVATIVE UPDATES.

I interpret this as meaning that the Bundler can handle the fact that my Gemfile is not the one it was expecting. Any help?

Features: Ruby 1.9.3, Rails 3.2.3, Capistrano 2.12.0, Bundler 1.1.4, Windows 7, deployment on a Posix machine.

Edit: My Gemfile contains logical blocks, such as:

unless RbConfig::CONFIG['host_os'] === 'mingw32' # gem 'a' ... end 
+80
ruby-on-rails bundler capistrano
Jul 16 2018-12-12T00:
source share
18 answers

The error message you receive regarding Gemfile.lock may be due to the fact that your Gemfile and Gemfile.lock do not agree with each other. It looks like you changed something in your Gemfile since the last time you ran bundle install (or update ). When you bundle install , it updates your Gemfile.lock with any changes you make to the Gemfile.

Make sure you run bundle install locally, and then go into the original control of your updated Gemfile.lock . Then try to deploy.

Change As noted in the comments, the condition in the Gemfile led to a valid Gemfile.lock on one platform, invalid on another. Providing the : platform flag for these platform dependent gems in the Gemfile should resolve the asymmetry.

+72
Jul 16 2018-12-12T00:
source share
— -

vi.bundle / config

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

run "bundle install"




OR

run the configuration "bundle config"

check if true is frozen, false is set

configuration package frozen false

+25
May 23 '15 at 12:00
source share

Beware of the global configuration of the bundler.

I had a global configuration in my dev environment in ~/.bundle/config that I did not have in my CI / Production environment, which caused Gemfile.lock to be Gemfile.lock in my dev environment different from the one in my CI / Work environment.

In my case, I set github.https to true in my dev environment, but didn't have that configuration in my CI / Production environment. This made the two Gemfile.lock different.

+19
Nov 12 '16 at 21:46
source share

When you see the following ...

 $ bundle install 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. If this is a development machine, remove the Gemfile freeze by running `bundle install --no-deployment`. You have added to the Gemfile: * source: rubygems repository https://rubygems.org/ * rails (~> 3.2) . . . 

... Then, most likely, the problem is related to outdated .gem files in the directory of your supplier / cache.

Perhaps you previously ran $bundle install --deployment , which put some "obsolete" .gem files in the cache?

In any case, you can bundle install --no-deployment this error by doing: bundle install --no-deployment

This is one of the many great features of Rails ... error messages often tell you what to do to fix this problem.

+10
May 24 '13 at 22:17
source share

My specific problem was that @JoshPinter was reported, i.e. dev-vs-deploy the host mismatches in the protocol used by the provider to fetch gems from github.

To make a long story short, all I had to change was the next Gemfile entry ...

 gem 'activeadmin', github: 'activeadmin' 

... to this safe syntax ( see link ):

 gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin.git' 

And my deployments returned to normal.

+6
Dec 22 '16 at 8:39
source share

The solution for me was slightly different from the others listed here. I tried to upgrade from sidekiq to sidekiq-pro (which requires a bundle of 1.7.12+), but I continued to receive the message "Are you trying to install in deployment mode after changing your Gemfile" from travis-ci

Checking the output to the travis-ci console showed that an older version of bundler was used.

In my case, I had to edit the travis.yml file to add:

before_install: - gem update bundler

This forced travis-ci to use the latest bundler and removed the error message.

+5
Sep 25 '15 at 19:02
source share
 rm -fr .bundle 

Fixed problem for me.

+3
Oct 25 '16 at 21:33
source share

I used to come across something similar. One way to fix this, I think, but might take up more space on your server than you want, is to run

 bundle install --deployment 

and then try to deploy. It does something like installing all of your gems in a vendor’s folder, which I think is generally good to avoid ... but it will probably work anyway. My application used for this behavior, my solution was to remove the exact versions to download from my Gemfile, and then reinstall and deploy.

 gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git', :branch => 'master' 

to

 gem 'rails_admin' 

Or you can do what it offers and Git your project from the production server to the local computer, bind it and then release it to your server. This solution may not be 100% correct, but some of them worked for me ... just thought I'd share. Good luck

+1
Jul 16 '12 at 22:52
source share

Another reason for the error:

It's a little silly, but I'm sure someone else will make the same mistake.

For Rails 4, Heroku added the stone rails_12 factor. If you used it before adding it, then you will have these two gems:

 gem 'rails_log_stdout', github: 'heroku/rails_log_stdout' gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets' 

You need to delete them when you add a new one. (they are included). I think you can get away from it until you touch their lines in your gem file, then Heroku notices duplication and screams with the above error.

Good luck with Rails 4.

+1
Aug 25 '13 at 1:04 on
source share

In our case, we used a function that was not available in the old version of bundler, which worked on our production machine. Therefore, it was enough to update the package, i.e. Make a gem update bundler .

+1
Jun 26 '15 at 8:41
source share

This may be a dangerous idea, but if you absolutely must test something in a production deployment environment, you can edit the .bundle / config file

 # This value is normally '1' # Set it to '0' BUNDLE_FROZEN: '0' 

Now the package is called, in my case I needed to update a specific stone, so my team

 RAILS_ENV=production bundle update <whatever gem> 

You should probably change it after the update, so now everything works as you expect. Again, this is probably not supported, and YMMV

+1
Feb 08 '17 at 18:38
source share

I came across this deployment of a Nesta application after some gem updates. What worked for me: uninstall Gemfile.lock , run bundle install to generate it and deploy it again.

0
Sep 28 '13 at 2:20
source share

I ran into a similar problem, but I did both bundle install and bundle update , and Heroku still rejected my push.

I fixed the problem by simply removing Gemfile.lock and then running bundle install again. Then I added, committed and dragged it to my git repository. After that, I had no problems pushing to Herok.

0
Jan 14 '14 at 15:20
source share

for heroku, you do not need to change the syntax in the Gemfile . you can simply add BUNDLE_GITHUB__HTTPS (note the double underscore) as an environment variable and set it to true (in your hero’s toolbar on the Settings tab in the Config Vars section). this will switch the protocol from git:// to https:// for all such requests.

0
Dec 24 '16 at 5:31
source share

I got an error message while trying to click on Heroku. I found a fixed solution.

  • Git pull origin master
  • Git status
  • Git commit
  • Git push origin master
  • Git push heroku master
0
Jul 13 '17 at 0:48
source share

This problem may be due to submodules pointing to older versions of code. For me, I solved this problem by updating my submodules

If you have submodules, try running:

git submodule update --init

bundle install

0
Jul 12 '18 at 6:13
source share

After this command, you can perform the normal installation of the package again:

 bundle install --no-deployment 
0
Dec 11 '18 at 23:35
source share

I read a dozen solutions on different resources, but could not find exactly what could help me in this situation.

So I found a solution. In fact, I carefully read the error message, and there was a solution: Run the batch installation elsewhere . “Elsewhere” was my Cloud9, where I developed my application. So my steps

  1. copy Gemfile and Gemfile.lock from the server to the local computer using the rsync command
  2. paste these two files into my RoR project (I used Cloud9)
  3. Open the Gemfile and make the changes I want. In my case, I added the gem 'thin'
  4. in terminal go to my application on Cloud9 and run bundle install . in this case you will have a modified version of Gemfile.lock
  5. copy the new Gemfile and Gemfile.lock to the server using rsync
  6. Go to the folder with my application and run bundle install --deployment --without development test again! Good luck to everyone!
0
Jan 28 '19 at 18:13
source share



All Articles