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 ?
The version of bundler that's used is the one that's available in your current ruby environment. The best way to manage this is with gemsets - you can create a gemset with a known, working version of bundler and always switch to that gemset when working with that project.
lock . In general, you should use bundle install(1) to install the same exact gems and versions across machines. You would use bundle update to explicitly update the version of a gem.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With