Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2 gems need different versions of the same dependency

Using Rails 3, I'm trying to figure out what I think should be pretty straightforward...

I have 2 gems that require 2 different versions of the same gem dependency. Both versions of the dependent gem are installed on my system but I still get an error from Rails: "Bundler could not find compatible versions for gem XXX".

What is the best practice to handle a scenario like this?

like image 599
ericalli Avatar asked May 26 '11 00:05

ericalli


3 Answers

I was having the same issue, but in a different context: Writing an app which uses two different versions of the hashie dependency (1.2.0 and 3.1.0)

I went into the Gemfile.lock and specified the older version in parentheses hashie (1.2.0), ran bundle install, and it worked.

like image 101
shawnbro Avatar answered Sep 24 '22 01:09

shawnbro


I'd go for what @BaroqueBobcat suggests. I just want to add that - if you need the latest Twitter gem and can't wait for the maintainer of Groupon2 to update his gem - you can fork the Groupon2 on GitHub, update its gemspec, see if it still works by running its tests (and try to fix it if it doesn't) and include your own version using its Git URL in your Gemfile like so: gem "groupon2", :git => "https://github.com/yourgithubuser/groupon2.git".

If you want to be nice you can offer your changes to the maintainer of Groupon2 with a pull request for bonus points :)

like image 9
Mark Avatar answered Oct 28 '22 03:10

Mark


If you don't need all the features of the Twitter gem version 1.4.1, you could use version 1.2.0, which needs faraday ~> 0.5.4. and that should work. If that doesn't, you could try poking the owner of groupon2 to update his gem--it's on github https://github.com/gangster/groupon2 .

like image 3
BaroqueBobcat Avatar answered Oct 28 '22 04:10

BaroqueBobcat