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
Related
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.
In our rails application, we are using two gems (urbanairship and nylas) that's requiring rest-client. One wants ~> 1.6.7 and the other wants ~> 1.7.1.
The usual bundle udpate and rm Gemfile.lock; bundle install doesn't work.
When Bundler is resolving dependencies, we are getting this:
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies............................................................................................................................................
Bundler could not find compatible versions for gem "rest-client":
In Gemfile:
urbanairship (~> 3.0.1) ruby depends on
unirest (>= 1.1.2, ~> 1.1) ruby depends on
rest-client (~> 1.6.7) ruby
nylas (>= 0) ruby depends on
rest-client (~> 1.7) ruby
We can't use unfortunately a different version of either nylas or urbanairship. The only solution we are seing is forking one of the two and editing the .gemspec to accept the same version of rest-client.
Is there any easier solution?
Finally, ended up following Chris advice.
Forked nylas
https://github.com/hartator/nylas-ruby/
Relaxed Gemfile requirements for rest-client. (was 1.7)
gem 'rest-client', '~> 1.6'
Relaxed nylas.gemspec requirements for rest-client. (was 1.7)
s.add_dependency(%q<rest-client>, ["~> 1.6"])
Relaxed nylas.gemspec runtime requirements for rest-client. (was 1.7)
s.add_runtime_dependency(%q<rest-client>, ["~> 1.6"])
Ran specs, everything was still passing.
Added the altered gem to my application Gemfile
gem 'nylas', git: 'git#github.com:hartator/nylas-ruby.git'
Everything is working. Still wondering if there is a cleaner solution out there.
Ref: https://github.com/hartator/nylas-ruby/commit/f7ff4076e96d8a31e223ca0f12d35811d6e9d811
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.
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
Hey when i try to 'require' the gem -> twitter (1.6.2) in my rails app I get an error
can't activate hashie (~> 1.1.0, runtime) for ["twitter-1.6.2"], already activated hashie-1.2.0 for ["instagram-0.8.4"]. I did 'gem list' and saw this hashie (1.2.0, 1.1.0). I removed the 1.1.0 version of hashie and that gave another error RubyGem version error: hashie(1.2.0 not ~> 1.1.0). How do I solve this issue?
You should probably look into upgrading the version of the twitter you're using. 1.6.2 is at least a year old. The gem is now on version 3.x and no longer has the hashie dependency.
If this isn't an option for you, you're really just left with forking the twitter gem source, modifying the 1.6.2 tag to suit your needs by either removing the hashie dependency or raising it's dependency version in twitter.gemspec, and then referring to your git fork in your Gemfile
gem "twitter", git: "git://github.com/...", "1.6.2"
Whether removing or raising the version restriction on the hashie gem dependency, you should re-run the tests for the twitter gem before deploying your site with this change.