Reputation: 3422
I am trying to bundle install a project running gem 'rails', '4.2.0'
.
Running Bundle install
, I get :
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.2.0) was resolved to 4.2.0, which depends on
bundler (>= 1.3.0, < 2.0)
Current Bundler version:
bundler (2.1.4)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails (= 4.2.0)', in any of the sources.
Thus I then try to install bundler v 1.3.0 to successfully bundle this gemfile : gem install bundler -v 1.3.0
gem list bundler shows me that I successfully installed bundler at v 1.3.0
Then when trying to bundle install with v 1.3.0 like this bundle _1.3.0_ install
, I get Could not find command "_1.3.0_".
How can I successfully run bundle install with that specific version of bundler ?
Upvotes: 16
Views: 38497
Reputation: 241
Basically, you need:
First, check if you have successfully install Bundler (>= 1.3.0, < 2.0) on your local machine:
$ gem list bundler
You should see:
*** LOCAL GEMS ***
bundler (2.1.4, 1.17.3, 1.3.0)
If not, install it:
$ gem install bundler -v "<2" -N
# Install lasted bundler below version 2
# -N: No document
Second, check if you can run that Bundler version:
$ bundle _1.17.3_ -v
You should see:
Bundler version 1.17.3
If you installed Bundler 1.17.3 but cannot run "bundle 1.17.3 -v", there is something wrong with your RubyGems gem. Check if you installed updated version (latest is 3.1.3):
$ gem -v
Try to update the RubyGems gem, because it is the one help you run a specific gem version:
$ gem update --system
You should see:
Updating rubygems-update
...
Installing RubyGems 3.1.3
Successfully built RubyGem
Name: bundler
Version: 2.1.4
File: bundler-2.1.4.gem
Bundler 2.1.4 installed
RubyGems 3.1.3 installed
Regenerating binstubs
...
------------------------------------------------------------------------------
RubyGems installed the following executables:
/home/lqt/.rbenv/versions/2.7.1/bin/gem
/home/lqt/.rbenv/versions/2.7.1/bin/bundle
...
RubyGems system software updated
Check again if you can run a specific Bundler version:
$ bundle _1.17.3_ -v
If you see:
Bundler version 1.17.3
Then, step 3, just run Bundler 1.17.3 to install other gems:
$ bundle _1.17.3_ install
Upvotes: 24
Reputation: 941
There was a bug with bundler previously, if you're using the wrong version of ruby gems. Try
gem update --system
Upvotes: 1
Reputation: 31
you can try to add this to your Gemfile,
gem 'bundler', '1.17.1'
then try these commands:
gem install bundler -v 1.3.0
gem uninstall bundler -v 2.1.4
bundle update --bundler
bundle install
Upvotes: 3
Reputation: 113
You can install bundler version 1.3 this way:
gem install bundler -v 1.3
And then use that specific version for installing gems:
bundle _1.3.0_ [install]
Hope that helps!
Upvotes: 4