Why does Bundler refuse to accept a gem with no version specified? - ruby-on-rails

The command:
bundle update
The error:
Bundler could not find compatible versions for gem "fog-core":
In Gemfile:
fog was resolved to 2.0.0, which depends on
fog-google (<= 0.1.0) was resolved to 0.1.0, which depends on
fog-core
fog was resolved to 2.0.0, which depends on
fog-internet-archive was resolved to 0.0.1, which depends on
fog-core (~> 1.45)
Bundler keeps finding that fog-core with no version specified is incompatible with fog-core (~> 1.45). I would think that no version in the .gemspec file means that any version is acceptable, but that doesn't seem to be the case.
This is happening with Bundler version 1.16.1 on a very large project, after attempting to upgrade the version of fog-aws.
My solution so far has been to fork every dependency, making the following change:
--- a/foo.gemspec
+++ b/foo.gemspec
- spec.add_dependency "fog-core"
+ spec.add_dependency "fog-core", "~> 1.45"
...but that's a stupid thing to have to do. There's got to be a better way.

After a day and a half of single-stepping through Bundler, I have arrived at an answer:
If both of the following things happen:
Bundler looks at a conflicting version of a package (such as librato-metrics) before finding the right version.
Another error of any kind happens, either before or after #1.
...Bundler will show the resolved conflict error along with all the other errors, even though the conflict was actually resolved and doesn't need to be addressed.

Related

Ruby gem conflicts

I'm trying to update a specific Slack-Client gem from version 1 to version 2.
The problem that the version 2 uses another gem called Faraday with version 2 and I have in Gemfile another gem called Kit that uses Faraday version 1.
Bundler could not find compatible versions for gem "faraday":
In snapshot (Gemfile.lock):
faraday (= 1.10.2)
In Gemfile:
oktakit was resolved to 0.3.3, which depends on
faraday (>= 0.17.3, < 2)
slack-ruby-client (= 2.0.0) was resolved to 2.0.0, which depends on
faraday (>= 2.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
I would like to know if there is a way to update Slack-Client to version 2 without create a new conflict
I've tried different approaches, but all of them create the same error
You cannot require the same gem multiple times in different versions in your application at the same time. In your case, this means that you cannot update slack-ruby-client to a version that requires faraday >= 2.0 while keeping the oktakit gem at a version that requires faraday < 2.
Because there is no never version of oktakit available, you are stuck and have to wait for oktakit to be updated.
What you could try, is forking those gems and try if one of them would work with the faraday version required by the other. Or you investigate if you can replace oktakit with any other Okta related gem that supports your use case.

How to fix 'could not find compatible version for gem "rails"'?

Im literaly bumping my head into a wall and I can not find a solution by myself about this problem.
I'm starting a project with Solidus , a Spree commerce fork. I played around with the gem for a litle while and now that I am ready to get serious and start to develop , I create a new project ad I'm bumping into this nasty error :
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 5.1.2)
In Gemfile:
rails (~> 5.1.2)
solidus was resolved to 1.0.0, which depends on
solidus_core (= 1.0.0) was resolved to 1.0.0, which depends on
rails (~> 4.2.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
and bundle update is not solving my problem... I am running out of solution and will appreciate some hands in help in how to fix this problem.
Thanks
Bundler is doing you a favor here by showing you that you have incompatible version requirements for the rails gem.
You have rails (~> 5.1.2) listed in your gemfile and the solidus gem has a dependency on rails (~> 4.2.0), so there is a conflict about which version of rails your app should use.
Is there a reason you are using solidus version 1.0.0? It looks like the latest version of solidus is 2.0.2 at present. Later versions of solidus will have a more recent dependency listed for rails, which will allow your application to use rails 5+.
Update the version of solidus in your gemfile to something more recent and see if that allows bundler to install successfully.

Why is Bundler version lookup selecting pre-release version here?

We have a gem which as development dependencies relies on sass-rails (specifically in version 5.0.4) which in turn depends on railties >4.0.0 and <5.0.
Now we don't check our Gemfile.lock into the repo to keep it as flexible as possible (it's our 'universal' gem after all), and during the travis build, installing sass-rails resolves its dependency railties to version 5.0.0.beta1, which I'd say intuitively isn't <5.0 and now causes problems when running the tests on ruby < 2.2.2 (due to rack).
Now, am I misunderstanding something or is this a bug, that bundler installs 5.0.0.beta1 for <5.0?
This is not a bug but expected behaviour. Prerelease versions are expected to be released before the actual release, hence they are considered smaller.
See http://ruby-doc.org/stdlib-2.0.0/libdoc/rubygems/rdoc/Gem/Version.html for more detail.
You can add a runtime dependency to railties '~> 4.0' to your gemspec to solve this problem.

rails - excon gem dependency conflict between mandrill-api & heroku-api

I have some dependency conflict since I try to add mandrill-api.
I've added the gem in my gemfile, but when I want to bundle install I've got this error :
Bundler could not find compatible versions for gem "excon":
In Gemfile:
mandrill-api (>= 0) ruby depends on
excon (~> 0.15.4) ruby
heroku-api (>= 0) ruby depends on
excon (0.13.4)
I've tried so many things to fix this, but impossible.
Even if I delete the heroku gems, I still get an error with fog.
Anyone has an idea? thanks !
Looking back it appears you must be using an older version of the mandrill-api gem (more recent ones have a much looser excon requirement). I think if you update to the latest mandrill-gem it should be less problematic and better cooperate with excon/heroku-api/fog. Do let me know if that isn't the case though and I can certainly dig deeper.

Error on Updating RefineryCMS

I am trying to update from refinery 1.0.9 to 2.0.9 on ruby 1.9.3. I am getting this error:
Bundler could not find compatible versions for gem "refinerycms-core":
In Gemfile:
refinerycms-news (~> 1.2) ruby depends on
refinerycms-core (~> 1.0.0) ruby
refinerycms (~> 2.0.9) ruby depends on
refinerycms-core (2.0.9)
Can you help me understand the error and what to do about it?
Bundler attempts to make sure that all of the dependencies of all gems (other gems, that is) are installed and meet version requirements specified by the gem designers.
In your Gemfile, you can specify versions of Gems in several ways, the ~> method says the version can be greater than or equal to the number specified, but not so great that a major release can get installed without you knowing.
So it looks like you'll need to relax the restriction on version on the refinery-news gem which likely has a later version available than the 1.2 currently allowed (That version depends on refinerycms-core 1.0.0, but refinerycms needs a later version of the same gem).

Resources