Bundle install could not find compatible versions for gem "bundler"

25,707

Solution 1

Your bundler gem is too big. You can downgrade for now by changing your gemfile to specify the lower version, and deleting the lock file again.

gem 'bundler', '1.17.1' 

Then try these commands in the terminal

gem install bundler -v 1.17.1
gem uninstall bundler -v 2.0.1
bundle update --bundler
bundle install

That last install command might be redundant. I'm on my phone so I can't test anything unfortunately.

Best of luck!

EDIT:

This is now a Heroku issue. Got it. Heroku docs regarding Bundler

Libraries The following libraries are used by the platform for managing and running >Ruby applications and cannot be specified. For application dependency resolution and management, bundler is installed based on the contents of your Gemfile.lock. If you have a BUNDLED WITH in your Gemfile.lock then you will receive a different version of Bundler:

Applications specifying Bundler 2.x in their Gemfile.lock will receive bundler: 2.0.1 Applications specifying Bundler 1.x in their Gemfile.lock will receive bundler: 1.15.2 Applications with no BUNDLED WITH in their Gemfile.lock will default to bundler: 1.15.2 For more information on available settings see Bundler configuration. For more information on why we only support a specific set of bundler versions, please see this article about your Bundler version.

So it seems like Heroku only allows certain versions of Bundler to be compatible, relevant doc is linked. Downgrade to 1.15.2 and give it another shot.

Solution 2

Try to use

gem install bundler -v 1.17.3
bundle _1.17.3_ install

Solution 3

You don't need to uninstall the newest version of bundler (especially if you have other applications).

First find the bundler version that you need. For example, after running bundle install:

Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails (~> 4.2)', in any of the sources.

I need any version between 1.3.0 and 2.0. Hence, I would go for bundler 1.9.

Then, install the bundler:

gem install bundler -v 1.9

Run that bundler version to install gems:

bundler _1.9_ install
Share:
25,707
nourza
Author by

nourza

Hi, I am a Ruby on Rails web developer and I would love to help :) https://www.paypal.com/donate?hosted_button_id=4PTP83QQLV98G

Updated on July 21, 2022

Comments

  • nourza
    nourza almost 2 years

    When I type bundle install I got this error. I tried to find solution but nothing solve my case. Please help me.

     Bundler could not find compatible versions for gem "bundler":
          In Gemfile:
            rails (= 4.1.8) was resolved to 4.1.8, which depends on
              bundler (< 2.0, >= 1.3.0)
    
          Current Bundler version:
            bundler (2.0.1)
        This Gemfile requires a different version of Bundler.
        Perhaps you need to update Bundler by running `gem install bundler`?
    
        Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails
        (= 4.1.8)', in any of the sources.
    
        Bundler could not find compatible versions for gem "rails":
          In Gemfile:
            rails (= 4.1.8)
    
            animate-rails was resolved to 1.0.10, which depends on
              rails
    
  • nourza
    nourza about 5 years
    Thank you. When I tried to push the update to heroku I got this error Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.17.1). We suggest you upgrade to the latest version of Bundler by running gem install bundler.
  • nourza
    nourza about 5 years
    rb-inotify-0.10.0 requires ruby version >= 2.2, which is incompatible with the remote: current version, ruby 2.0.0p648
  • ShatteredDev
    ShatteredDev about 5 years
    oh, then try running all the commands again, but replace the bundler version 1.17.1 with 1.15.2. I saw something specific to Heroku for this, i'll see if I can find it
  • John Skiles Skinner
    John Skiles Skinner over 4 years
    The second of these commands alone, bundle _1.17.3_ install, fixed this issue for me