Bundler could not find compatible versions for gem

bundler could not find compatible versions for gem "railties":
bundler could not find compatible versions for gem "activesupport":
bundler could not find compatible versions for gem actionpack
bundler could not find compatible versions for gem 'rails
bundler could not find compatible versions for gem "activerecord":
bundler could not find compatible versions for gem actionmailer
bundler could not find compatible versions for gem "json"
bundler could not find compatible versions for gem rubyzip

I've added a gem 'koala' to my Gemfile and seems to have thrown gem versions out of whack when I run the 'bundle install' command:

Bundler could not find compatible versions for gem "faraday":
In snapshot (Gemfile.lock):
faraday (0.6.1)

In Gemfile:
koala (~> 1.2.0beta1) depends on
  faraday (~> 0.7.4)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

How can I resolve this conflict?

Delete the contents of Gemfile.lock, and run bundle install again. That's been working for me.

"Bundler could not find compatible versions", Bundler could not find compatible versions for gem "activemodel": In Gemfile: rails (~> 4.0.13) was resolved to 4.0.13, which depends on� $ BUNDLE_GEMFILE=Gemfile.rails5 bin/bundle update Bundler could not find compatible versions for gem "sinatra": In snapshot (Gemfile.rails5.lock): sinatra (= 2.0.0) In Gemfile.rails5: resque (~> 1.25) was resolved to 1.27.4, which depends on sinatra (>= 0.9.2) webvalve was resolved to 0.9.6, which depends on sinatra-contrib (< 3, >= 1.4) was

Did you run bundle update as the error message points out? bundle install handles changes to the Gemfile and bundle update upgrades gems that are already managed by Bundler. The Gemfile.lock file locks in version numbers, bundle update will update any of those that aren't directly specified in your Gemfile (like gem 'rails', '3.0.9').

Deleting the Gemfile.lock will work, but running bundle update is better.

Bundler could not find compatible versions for gem "bundler" � Issue , 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 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

You can't simply delete you Gemfile.lock if that is a solution then why Gemfile.lock is exist in the first place, you code depend on the versions locked in this file, try to only update the Gem which cause the conflict by using bundle update gem_name and you have to check the ReadMe if any changes needed to work with the new version otherwise you are breaking your code or others code.

Redmine: Bundler could not find compatible versions for gem, Bundler could not find compatible versions for gem "actionpack": In snapshot ( Gemfile.lock): actionpack (= 4.2.10). In Gemfile: rails (~> 4.2.8)� Bundler could not find compatible versions for gem "bundler": In Gemfile: rails (= 4.2.11) was resolved to 4.2.11, which depends on bundler (>= 1.3.0, < 2.0) Current

I found that by removing the specified version of rails solved the problem for me .... instead of:

gem rails, '4.0.4'

I did

gem rails

followed by deleting the Gemfile.lock and re-running bundle install

Bundler could not find compatible versions for gem "bundler , Please advise. Bundler could not find compatible versions for gem "bundler": In Gemfile: rails (= 4.2.4) was resolved to 4.2.4, which depends on Bundler could not find compatible versions for gem "rack": In snapshot (Gemfile.lock): rack (= 2.0.4) In Gemfile: coffee-rails (~> 4.2) was resolved to 4.2.2, which depends on railties (>= 4.0.0) was resolved to 5.1.5, which depends on actionpack (= 5.1.5) was resolved to 5.1.5, which depends on rack (~> 2.0) omniauth (~> 1.2.1) was resolved to

If deleting Gemfile.lock doesn't work there is another possibility:

It may be possible a gem you are depending on has inadvertently included its own Gemfile.lock in its .gem file. The solution is to update the offending gems to not include a Gemfile.lock, rebuild and reinstall.

Problem with Install The SpreeFancy Theme: "Bundler could not find , Bundler could not find compatible versions for gem "spree_core": In snapshot ( Gemfile.lock): spree_core (= 3.6.2). In Gemfile: spree (= 3.6.2)� Bundler could not find compatible versions for gem "sprockets": In Gemfile: sass-rails (~> 4.0.3) ruby depends on sprockets (<= 2.11.0, ~> 2.8) ruby rails (= 4.1.8) ruby depends on sprockets-rails (~> 2.0) ruby depends on sprockets (2.12.3) run bundle exec spring binstub --all bundler: command not found: spring Install missing gem executables

Bundler could not find compatible versions for gem “bundler”, Bundler could not find compatible versions for gem "bundler": In Gemfile: bundler -audit (~> 0.5.0) was resolved to 0.5.0, which depends on� Bundler could not find compatible versions for gem "nokogiri": In Gemfile: nokogiri (~> 1.8.1) capybara (~> 2.13) was resolved to 2.18.0, which depends on nokogiri (>= 1.3.3) rails-dom-testing was resolved to 2.0.3, which depends on nokogiri (>= 1.6) roadie (~> 3.2.1) was resolved to 3.2.2, which depends on nokogiri (~> 1.5) Bundler could not

could not find compatible versions for gem “multi_json”:, You can try by adding gem "multi_json" in Gemfile. Also, delete the Gemfile.lock file and then run bundle install. This might help you overcome� Bundler could not find compatible versions for gem " activemodel ": In snapshot (Gemfile.lock): activemodel (= 5.2. 1) In Gemfile: activerecord-import was resolved to 0.27. 0, which depends on activerecord (>= 3.2) was resolved to 5.2. 1, which depends on activemodel (= 5.2. 1) rails (~> 5.2. 2) was resolved to 5.2. 2, which depends on

Why you should run bundle update, Bundler could not find compatible versions for gem "activesupport": In snapshot ( Gemfile.lock): activesupport (3.0.0) In Gemfile: rails (= 3.0.3)�

Comments
  • I was unable to install rails_admin, and this just fixed it for me too. Thanks for posting!
  • This will spontaneously upgrade a whole bunch of your gems. It's better to do them one at a time and test, as updating gems can introduce bugs
  • if someone has error Bundler could not find compatible versions for gem "jekyll", just delete version part of your project Gemfile , i mean change gem "jekyll", "~> 4.0.0" to gem "jekyll"
  • Coming from JS world, I had used fixed versions for all my gems and all hell broke loose. I wanted to configure Jekyll with Github Pages... The trick was to remove all fixed versions and remove the lock file then run bundle again