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

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.

Related

Why does Bundler refuse to accept a gem with no version specified?

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.

gem dependency conflict because of nori

how to resolve this type of errors
In Gemfile:
appdirect (>= 0) ruby depends on
nori (~> 2.4) ruby
google-adwords-api (>= 0) ruby depends on
google-ads-common (~> 0.9.8) ruby depends on
savon (~> 1.2.0) ruby depends on
nori (1.1.5)
Please tell. I tried updating google-adword-api gem but its not working.
Unfortunately, google-ads-common gem is sticked to old version of savon, here's what gem author says:
Savon 2 does not support the complex AdWords API wsdls. I would love to upgrade and put this to rest, but it isn't feasible at the moment. We are looking into alternatives.
In this sad situation you need to choose between conflicting gems, you can't have both at once.
I have edited appdirect to use compitable version of nori.
Here is the link to the gem
https://github.com/aditya01933/appdirect

How to override gem dependency?

I have 2 gems that depend on conflicting versions of hashie (one requires ~> 1.2.0 and the other requires 3.3.1):
Bundler could not find compatible versions for gem "hashie":
In Gemfile:
restforce (>= 0) ruby depends on
hashie (~> 1.2.0) ruby
omniauth (>= 0) ruby depends on
hashie (3.3.1)
I'd like to keep both gems and use the higher version of hashie. Is there a way for me override one of the gem dependencies?
The standard advise is to use the higher version compatible.
I do this way, but I think bundler has a defined command for it.
First remove the line of gem 'omniauth' at your Gemfile. Run bundle install, then you must add again the line with gem 'omniauth' to your Gemfile, run bundle install again.
If you look at Gemfile.lock, this install hashie 2.0.5, the higher compatible.
Edit: why does this work?
First I check omniauth dependencies with hashie: hashie < 4, >= 1.2, then the same with restforce: hashie < 2.1, >= 1.2.0. At this point, I know that any version of hashie between 1.2 and 2.0.x must work. Then we must to remove the constraint at Gemfile.lock of continue using hassie 3.3.1, removing 'omniauth' from Gemfile it's done. After that, when install restforce, the bundler find the new version compatible with restforce '2.0.5'. And when you add again omniauth bundler don't update dependencies that are accomplished.
I think bundle update is actually what you were after. That sorts out dependencies and installs different versions of gems if required, giving you the most up-to-date gems possible.
Be careful however, as updating gems can introduce compatibility issues.

Bundler fails because it can't find compatible version of faraday gem

I'm trying to install a the instagram-ruby-gem but bundler keeps failing with this error:
Bundler could not find compatible versions for gem "faraday":
In Gemfile:
instagram (>= 0) ruby depends on
faraday (< 0.9, >= 0.7.4) ruby
instagram (>= 0) ruby depends on
faraday (0.9.0)
Here's my Gemfile:
gem 'instagram', git: 'https://github.com/larrylv/instagram-ruby-gem.git'
I am using this specific fork because it fixes the faraday version to be compatible with Rails 4. See the commit here, but here's the change:
- s.add_runtime_dependency('faraday', ['>= 0.7', '< 0.9'])
+ s.add_runtime_dependency('faraday', '>= 0.7.4', '<= 0.9.0')
I already tried bundle update. That did not work. The only faraday version installed is faraday 0.9.0.
I downloaded the forked gem, built it and then installed it. It looks like it went through without any issues on my end. So it is something to do with the environment or a gem conflict issue. I'd check to make sure you don't have any other versions of the gem installed. Do you use RVM by any chance and use gemsets with RVM? As a last resort you could delete the Gemfile.lock, but that is not really recommended. You could look at the Gemfile.lock file as well and look at the faraday references. Perhaps other gems need a certain version and the forked gem you use requires another version? I have run in to that before. It is not fun to try and resolve.
Mike Riley

Is there a way around this gem dependency issue?

I want to use both the twitter gem and the pingdom-client gem in a small api health/status site I need to build.
When I try to bundle install the pingdom-client gem, I get the following error.
Bundler could not find compatible versions for gem "faraday":
In Gemfile:
pingdom-client (>= 0) ruby depends on
faraday (~> 0.5.6) ruby
twitter (>= 0) ruby depends on
faraday (0.8.4)
What are my options for resolving this issue? Or do I need to abandon the use of one of these gems?
There isn't a newer version of pingdom-client available with a better dependency, so you can try creating one on your own.
Uninstall all versions of faraday with gem uninstall faraday
Fork pingdom-client.
Change it's dependency on faraday to (~> 0.8.4) it it's pingdom-client.gemspec
Change your Gemfile line to
gem 'pingdom-client', git: 'url/to/your/git/fork.git'
Run bundle
Check your application to see if all is well with pingdom-client running the newer version of faraday

Resources