Bundler: You Must Use Bundler 2 Or Greater With This Lockfile
Answer :
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.1.4, 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.1.4
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:
Delete the
Gemfile.lock
filePlease don't create it again by running
bundle install
.Run your
docker build
ordocker-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.
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-
- I deleted gemfile.lock
- Run the command -
bundle install
That solved my problem, it is smooth! Hope will work for others!
Comments
Post a Comment