简体   繁体   English

为什么Bundler拒绝接受未指定版本的gem?

[英]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) . 捆绑不断发现fog-core无指定版本是不兼容的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. 我认为.gemspec文件中没有任何版本意味着任何版本都是可以接受的,但事实并非如此。

This is happening with Bundler version 1.16.1 on a very large project, after attempting to upgrade the version of fog-aws . 在尝试升级fog-aws版本之后,在一个非常大的项目上使用Bundler版本1.16.1就会发生这种情况。

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: 经过一天半的单步穿越Bundler,我得出了一个答案:

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. Bundler在查找正确版本之前会先librato-metrics软件包的冲突版本(例如librato-metrics )。
  2. Another error of any kind happens, either before or after #1. 在#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. …捆绑软件将显示已解决的冲突错误以及所有其他错误,即使该冲突实际上已经解决且无需解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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