简体   繁体   中英

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:

  1. Bundler looks at a conflicting version of a package (such as librato-metrics ) before finding the right version.
  2. 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.

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