I\'m executing the following script:
gem install rdoc --no-document
gem install bundle
bundle
output:
+ gem install rdoc --
Bundler version 2 introduced a new feature to automatically use the version of Bundler specified in the Gemfile.lock
of your project. Thus, if you have an existing Gemfile.lock
with a line like this at the bottom
BUNDLED WITH
1.17.3
Bundler will try to run with a Bundler version < 2.0. Since you just have Bundler 2.0.1 (and Rubygems >= 2.7.0) installed, this fails with this rather unhelpful error message.
To fix this, you could
Gemfile.lock
and to use bundler 2.x everywhere from now on, orgem install bundler -v '< 2.0'
to use the appropriate version as specified by your Gemfile.lock
.More information about this can be found on the Bundler blog.
I just faced the same error today. The bundler version which I had installed in my system previously was: 1.16.6
Followed the instructions in the official bundler docs on How to Upgrade to Bundler 2 and the below two steps did the trick:
gem install bundler
(Helps you get the latest version of bundler which as of today is 2.0.2)bundle update --bundler
I couldn’t even do bundle -v
. This sorted it out:
gem update --system
Got the info from here (similar problem): find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)
Probably some version mismatch between ruby + gem + bundler
As per the description mentioned in the post , before running the below mentioned command:
bundle install
in the script, you need to run the below command:
gem install bundler
So, the sequence of commands to work would be:
gem install bundler
bundle install
Update the bundler command if if does not work to:
gem install bundler -v '1.17.3'
Reason for the break in functionalities in bundler 2.0 is given in below mentioned link:
https://bundler.io/blog/2019/01/04/an-update-on-the-bundler-2-release.html
You've to install the exact version of Bundler that RubyGems is looking for by running:
$ gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)"
I had the same problem recently. In my case I have installed a version on bundler different from what is logged in the Gemfile.lock. Please check