0
votes

Trying to install a new gem into a rails app and regardless of whether I add or remove a gem from the Gemfile, when I run bundle install, I get the following error:

Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 3.0.0) ruby depends on
      bundler (~> 1.0.0) ruby

  Current Bundler version:
    bundler (1.3.5)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

I am confused, because ~> 1.0.0 means that I have to have a version of bundler equal to or greater than 1.0.0 but less than 2.x.x. I'm fulfilling this requirement, so why is it failing?

Just to add, if I leave the Gemfile as is, bundle install works just fine.

UPDATE

Clearly, I misunderstood the ~> symbol. You can look at the checked answer below for an explanation, or an even more in depth one at Meaning of tilde-greater-than (~>) in version requirement?

1
There's still the same issue popping up nowadays, here's a concrete solution when you can't update the application to use a newer bundler version: stackoverflow.com/questions/57170296Christian

1 Answers

0
votes

Actually ~> 1.0.0 is equal to >= 1.0.0 && < 1.1, so 1.3.5 doesn't match. You need another bundler version.