user2738308
user2738308

Reputation: 23

Change version of a dependent gem

I am installing through Bundler a gem A that depends on a version of another gem faraday-stack 0.1.3 that is lower than what is required (requires faraday-stack 0.1.5) by still another gem B. How can I force the first gem A's dependency to the higher one 0.1.5?

Upvotes: 1

Views: 1145

Answers (2)

Tim Moore
Tim Moore

Reputation: 9482

If gem A is specifying an exact version of 0.1.3, that indicates that it is incompatible with later versions such as 0.1.5.

It could be that the dependency for gem A is incorrectly over-constrained, and in reality it would work with 0.1.5 if the gemspec allowed it. If that's the case, the gemspec for gem A needs to be fixed to have a more permissive dependency on faraday-stack (for example, ~> 0.1.5, which means the same as >= 0.1.5, < 0.2.0).

On the other hand, if gem A actually is incompatible with faraday-stack 0.1.5, then what you're trying to do won't work. Either gem A will need to be updated so that it works with 0.1.5, or gem B will need to be updated so that it works with 0.1.3.

Upvotes: 2

Jack Bracken
Jack Bracken

Reputation: 1283

Just specify the version of the faraday-stack gem in your Gemfile before gem A or B.

gem 'faraday-stack', '0.1.5'
gem 'A'
gem 'B'

I believe this is pretty much a duplicate of this question.

Upvotes: 0

Related Questions