Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve the update bundler warning in rails when deploying to heroku?

How do I solve the following warning? I updated my ruby version to 2.3.1 and rails version to 4.2.6. I get this warning when I push my app to heroku.

remote:        Cleaning up the bundler cache. remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. remote:        Removing mime-types-data (3.2016.0221) 

I removed the Gemfile.lock and ran bundle install and also tried to update the bundler but the warning never goes away .

suramai@rails-tutorial:~/workspace/converse (master) $ gem install bundler Successfully installed bundler-1.12.4 1 gem installed suramai@rails-tutorial:~/workspace/converse (master) $ 
like image 995
LovingRails Avatar asked May 22 '16 13:05

LovingRails


People also ask

What version of bundler does heroku use?

It is fixed in 2.5. 5+ and 2.6. 3+. If you do not update, your Ruby version then every new release of Bundler 2.

How do I install latest version of bundler?

To install it the usual way, run gem install bundler and RubyGems will install the latest version of Bundler.


1 Answers

So it's complaining that the version of bundler installed on heroku is older than the version you used to create your Gemfile.lock on your dev machine.

You can probably just ignore the warning -- in most cases installing with a slightly older version of bundler than you used to create the Gemfile.lock is just fine.

bundler recently added the recording of the version of bundler used in the Gemfile.lock, and then the subsequent warning, because in some cases a new feature added to a new version of bundler might have been used to create the Gemfile.lock, such that installing with an older version might not work right. So sometimes it can be a problem. Although usually it won't be.

It doesn't look like you can get heroku to install with a different version of bundler.

If you want to make the warning go away, you could instead choose to use the same version of bundler locally that heroku uses. It's a bit hard to figure out exactly what version of bundler heroku is using -- it would be nice if that warning line actually told you the two different versions of bundler involved! But it doesn't.

This heroku support doc suggests that heroku is using bundler 1.11.2. (Right now; it could change in the future!). We can see from your log that you are using 1.12.4. If you want to use 1.11.2 instead, to avoid the warning, then, remove all versions of bundler installed on your system:

 gem uninstall bundler 

Then install 1.11.2 specifically:

 gem install bundler -v 1.11.2 

In general, when you use the bundle command, it will use the latest version installed on your system, so to make sure you are always using 1.11.2, make sure that's the latest version installed on your system, and never install a later one.

Then you need to regenerate your Gemfile.lock such that it says it was bundled with 1.11.2, to not get the warning anymore. This is kind of pain, the easiest thing to do might be to edit the Gemfile.lock by hand, and then going forward only ever use bundler 1.11.2.

To use bundler 1.11.2 even if you do want to have later versions of bundler installed on your system, then every time you do a bundle install or bundle update (for an app that will be deployed to heroku anyway), you could do it as:

 bundle _1.11.2_ install 

etc. That will tell rubygems to run the bundle install command with bundler version 1.11.2, and then that version will be recorded in the Gemfile.lock, and you won't get the warning.

This is all a bit of a mess. Many developers probably just ignore the warning. It should normally be fine.

like image 97
jrochkind Avatar answered Sep 28 '22 12:09

jrochkind