Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 673
nourza Avatar asked Feb 27 '19 08:02

nourza


People also ask

How do I fix a run bundle to install missing gems?

Select Tools | Bundler | Install from the main menu. Open the Gemfile, place the caret at any highlighted gem missing in the project SDK and press Alt+Enter . Select Install missing gems using 'bundler' and press Enter .

How do I change my bundle version?

If you want to upgrade the Bundler version used by your application, you can run bundle update --bundler , and your lockfile will be regenerated using the latest version.

Where does bundler install gems?

gem files your app uses in vendor/cache . Running bundle install will prefer gems in vendor/cache to gems in other locations. Save this answer.

What is the difference between bundle and bundler?

The executables bundle & bundler have the same functionality and therefore can be used interchangeably. You can see in the bundler/exe directory that the bundler executable just loads the bundle executable. It seems to me that the bundle command is more commonly used than the bundler command.


3 Answers

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.

like image 130
ShatteredDev Avatar answered Oct 12 '22 00:10

ShatteredDev


Try to use

gem install bundler -v 1.17.3
bundle _1.17.3_ install
like image 29
Vivekanand Panda Avatar answered Oct 11 '22 23:10

Vivekanand Panda


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
like image 25
B-M Avatar answered Oct 12 '22 01:10

B-M