Bower - 固定到主要版本要求解决

Bower - Pinning to Major Versions Asks for Resolution

当所有内容都固定到 ^ 主要版本时,为什么会要求我提供解决方案?我想我在 github 上的发布中做错了什么,因为它只要求解决我的回购协议,而不要求解决两个不同的次要版本的聚合物。

我 运行 bower install bower.json:

{
  "name": "test1",
  "homepage": "https://github.com/tylergraf/test1",
  "version": "0.0.2",
  "dependencies": {
    "test2": "git+https://github.com/tylergraf/test2#^0.0.3",
    "test3": "git+https://github.com/tylergraf/test3#^0.0.5"
  }    
}

test2 bower.json 看起来像这样:

{
  "name": "test2",
  "homepage": "https://github.com/tylergraf/test2",
  "version": "0.0.3",
  "dependencies": {
    "test3": "git+https://github.com/tylergraf/test3#^0.0.3",
    "polymer": "git+https://github.com/polymer/polymer#^1.7.0"
  }
}

test3 bower.json 看起来像这样:

{
  "name": "test3",
  "homepage": "https://github.com/tylergraf/test3",
  "version": "0.0.5",
  "dependencies": {
    "test2": "git+https://github.com/tylergraf/test2#^0.0.2",
    "polymer": "git+https://github.com/polymer/polymer#^1.4.0"
  }
}

这是我的输出:

Unable to find a suitable version for test2, please choose one by typing one of the numbers below:
    1) test2#^0.0.2 which resolved to 0.0.2 and is required by test3#0.0.3, test3#0.0.5
    2) test2#^0.0.3 which resolved to 0.0.3 and is required by test1

Prefix the choice with ! to persist it to bower.json

? Answer 2

Unable to find a suitable version for test3, please choose one by typing one of the numbers below:
    1) test3#^0.0.3 which resolved to 0.0.3 and is required by test2#0.0.3
    2) test3#^0.0.5 which resolved to 0.0.5 and is required by test1

Prefix the choice with ! to persist it to bower.json

? Answer 2

我深入研究了 bower 并了解了 semver。

主要零是 semver 规范中的一个特例,小于 0.1.0 的任何内容都将始终完全解析为自身。

^0.0.1 总是指向 0.0.1.

这里是 node.js article:

CARET: MAJOR ZERO Given Node.js community norms around the liberal usage of major version 0, the second significant difference between tilde and caret has been relatively controversial: the way it deals with versions below 1.0.0. While tilde has the same behaviour below 1.0.0 as it does above, caret treats a major version of 0 as a special case. A caret expands to two different ranges depending on whether you also have a minor version of 0 or not, as we'll see below: MAJOR AND MINOR ZERO: ^0.0.Z → 0.0.Z Using the caret for versions less than 0.1.0 offers no flexibility at all. Only the exact version specified will be valid. For example, ^0.0.3 will only permit only exactly version 0.0.3.

special-case for 0.x in ^ is very counter-inutitive and rage-inducing