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.
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.
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.
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
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.
An alternative is to go to your Gemfile.lock
and delete all references to the offending gem (in this case the faraday
gem).
Then run bundle install
and it'll update the Gemfile.lock
to have compatible versions of the gem where it needs.
If you want to be extra safe you can go to the Gemfile
and specify the versions of the gems you want before doing this.
This was the only way I was able to get bundle install
running for one of the systems that I'm maintaining.
This system has a lot of old gems in its dependencies (58 gems at the time of writing) and so bundler
has a hard time coping with it.
If I delete the Gemfile.lock
and run bundle install
it'll blow up with multiple Bundler could not find compatible versions for gem xxxxxx
errors.
If I run bundle update
it would also blow up with multiple Bundler could not find compatible versions for gem xxxxxx
errors.