Mismatched Bundler Version - Bundler 2, Ruby 2.6

Mismatched bundler version - bundler 2, ruby 2.6

The diagnose in your answer seems right. But it seems you can activate the latest installed Bundler gem (installed by gem install bundler) by adding this before the require 'bundler/setup' line:

Gem::Specification.find_by_name('bundler').activate

More specific version requirements can also be used if needed. For example:

Gem::Specification.find_by_name('bundler', '~> 2.0.1').activate

find_by_name throws LoadError derived exception if the gem is not found.

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

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.

Bundler 2.0.1 installed, Rails says must use Bundler 2 or greater?

I ran into the same issue & resolved it by downgrading with gem uninstall bundler, followed by gem install bundler -v 1.17.3 to revert back to the last pre 2 version.

I saw this across 3 separate systems using different version managers (ASDF, rbenv, rvm) and this resolved the issue.

There is some information on getting both versions to play nicely here. The root cause of this issue may have been a bug (which appears to have since been fixed)

Per the comment from @MatijsvanZuijlen below, and the bundler documentation, you should also be able to specify which version of bundler you want to use at runtime with bundle _1.17.3_ install

Travis builds on Ruby 2.6.3 have bundler version mismatch

Have you tried a before_install step to upgrade bundler before it attempts bundle gem install?

before_install: gem update bundler

Warning: the running version of Bundler is older than the version that created the lockfile error

Just run gem install bundler:2.1.4, don't worry about the older version that comes with ruby, it should not be used.

[Trying to Deploy]: You must use Bundler 2 or greater with this lockfile

  1. Remove your Gemfile.lock

  2. Install old version of bundler, for example

gem install bundler -v 1.17.3

  1. Run this bundler in your project directory
bundle _1.17.3_ install

  1. Make any commit, for example
git commit -am "Bundler 1.17.3 was installed"

  1. Run
git push heroku master

  1. Smile

You must use Bundler 2 or greater with this lockfile. When running docker-compose up locally

Adding this line before RUN bundle install to the Dockerfile did the trick for me.

RUN gem install bundler -v 2.0.1

Leaving this here for future reference!



Related Topics



Leave a reply



Submit