简体   繁体   中英

Bundler could not find compatible versions for gem

I'm building this gem which is currently private but will be open sourced later on.

In the .gemspec I have spec.add_dependency 'hashie', '~> 3.3.2' .

When using the gem in my app I get:

Bundler could not find compatible versions for gem "hashie":
  In Gemfile:
    desk (~> 1.0.4) ruby depends on
      hashie (~> 2.1) ruby

    my_gem (>= 0) ruby depends on
      hashie (3.3.2)

How do I go about solving such issue?

One way is to remove the lock on ~> 3.3.2 which works but I prefer not to do that.

I have tried deleting the Gemfile.lock from the app and run bundle install/update but that didn't work either.

I have accepted @ascar answer because that's the right thing to do. People suggest that you should fork gems to ensure compatibility.

Now what have I done in the spirit of OSS :) I have actually submitted a PR on the Desk gem to update the hashie gem.

Welcome to dependency hell :). It's not possible to use two different versions of the same gem.

You could try to fork desk and update to hashie ~> 3.3.2 there or simply go with hashie ~> 2.1 and downgrade your hashie to a 2.x version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM