You must use Bundler 2 or greater with this lockfile

两盒软妹~` 提交于 2019-11-28 19:26:18

A bit late to the party but I just ran into this today as well, and this solution avoids having to uninstall Bundler: just run

heroku buildpacks:set https://github.com/bundler/heroku-buildpack-bundler2

as per discussion on the Bundler issue here.

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!

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 locally. To do this, run

gem update --system

And then finally run

bundler update --bundler

That's all.

I hope this helps.

Yup, so generally uninstalling your version of bundler, removing the gemfile.lock, and finally running gem install bundler -v 1.15.2(which is the version heroku is using) worked.

After that running git push heroku master worked!

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).

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

I deleted the project and made a git clone from the Heroku app, don´t know if it is a good solution, but it worked for me.

I got the same issue in my local system, my ruby version was low due to which the error was occurring. Fixed it by switching it to updated versions of ruby.

Even with bundler 2 on the system this error still happens when deploying an app with Ruby 2.6 since Ruby 2.6 ships with a default version of bundler.

If you are using Ruby 2.6 then upgrade to Ruby 2.6.1 to avoid this issue.

For people who are not using Heroku:

I Tried everything and I was still receiving this error. even this link didn't help me: https://github.com/jekyll/jekyll/issues/7463

So this was my solution:

Push your code on GitHub. delete project folder create a new folder and pull your code bundle install That's it. bundler update --bundler was not helping me at the end and I didn't use it.

One more important thing: I updated my ruby version but I was getting this error because my RVM default version was an old version. even when you use rvm use VERSION_NUMBER -- default will not help because as soon as you log out from terminal the default version will change to the old one and you will have the same issue.

For this you can use this answer: How to set default Ruby version with RVM?

or just uninstall old ruby version with rvm uninstall X.X.X and install the new one with rvm install X.X.X and make it default by rvm use --default X.X.X.

cheers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!