Bundler: You must use Bundler 2 or greater with this lockfile

前端 未结 18 2349
小蘑菇
小蘑菇 2020-12-04 14:13

I\'m working with heroku and every time I try to push my app this message shows out:

remote: Compressing source files... done.
remote: Building source:
remo         


        
相关标签:
18条回答
  • 2020-12-04 14:45

    I had same issue on Local Machine(Development) as-

    You must use Bundler 2 or greater with this lockfile.
    The issue was with gemfile.lock because my local bundle version and project bundle version was not matching! Here is solution-

    1. I deleted gemfile.lock
    2. Run the command - bundle install
      That solved my problem, it is smooth! Hope will work for others!
    0 讨论(0)
  • 2020-12-04 14:45

    Heroku does not use Bundler 2.0, but 1.15.2, as the tracelog hints.

    As far as I am aware, the "workaround" is to create your own buildpack, or simple fork their own:

    Open lib/language_pack/ruby.rb in your editor, and change the following line:

    BUNDLER_VERSION = "1.11.2"

    (README.md at https://github.com/heroku/heroku-buildpack-ruby)

    Update: As of Ruby 2.6.1 and Bundler 2.0.1, Heroku now does support Bundler 2.0.1. https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues

    This is not the case for Ruby 2.6.0, as this is incorrectly invoked from binstubs, as @Schneems has mentioned in the comment. He has kindly reported this as a Ruby Bug #15622

    0 讨论(0)
  • 2020-12-04 14:47

    I had a similar experience.

    Here's how I solved it

    Display a list of all your local gems for the bundler gem

    gem list bundler
    

    N/B: The command above is for rbenv version manager, the one for rvm might be different

    This will display the versions of the bundler gem installed locally

    bundler (2.0.2, default: 1.17.2)
    

    if you don't have bundler version 2 installed locally, then run

    gem install bundler
    

    OR

    gem install bundler -v 2.0.2
    

    if you have bundler version 2 already installed locally or just installed it, then you need to simply install an update for RubyGems Package Manager locally. To do this, run

    gem update --system
    

    And then finally run

    bundle update --bundler
    

    For Docker projects in Ruby on Rails

    If you're experiencing this issue when trying to build your application using Docker, simply do this:

    1. Delete the Gemfile.lock file

    2. Please don't create it again by running bundle install.

    3. Run your docker build or docker-compose build command as appropriate to build your project.

    This will re-create the Gemfile.lock file and setup the appropriate version of bundler necessary for your project in the Gemfile.lock file.

    N/B: As a side note, you can also add this environment variable to your Dockerfile with the Bundler version defined.

    ENV BUNDLER_VERSION=2.1.4
    

    That's all.

    I hope this helps.

    0 讨论(0)
  • 2020-12-04 14:47

    I resolved this issue by running gem uninstall bundler to remove 2.0.0.pre.1, renamed the Gemfile.lock file (to remove it from use) and then ran bundle install to reinstall the gemfiles. In my case, I already had access to the earlier bundler version installed by heroku (so when I ran gem uninstall, I was shown all versions available and chose to remove 2.0.0.pre.1).

    0 讨论(0)
  • 2020-12-04 14:49

    I had the same issue. In my Gemfile.lock i saw at the end "bundled with bundler 2.0.2", but running bundle --version gave me version 1.17... For me it solved just updateing my bundler with the following command: bundle update --bundler see bundler documentation

    0 讨论(0)
  • 2020-12-04 14:50

    simple gem update bundler did it for me.

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