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

前端 未结 1 1998
耶瑟儿~
耶瑟儿~ 2021-02-01 02:28

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:             


        
相关标签:
1条回答
  • 2021-02-01 03:14

    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.

    0 讨论(0)
提交回复
热议问题