凉亭 - 固定到主要版本要求解决

时间:2017-02-04 14:13:39

标签: bower semantic-versioning

为什么当所有内容都固定在^主要版本时,这会要求我提供解决方案?我想我在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

1 个答案:

答案 0 :(得分:2)

我挖到了凉亭,然后开始了。

主要零点是semver规范中的特殊情况,任何小于0.1.0的内容都将始终精确解析为自身。

^0.0.1始终指向0.0.1

这是node.js article

  

CARET:MAJOR ZERO鉴于Node.js围绕着自由主义者的社区规范   使用主要版本0,第二个显着的区别   波尔德和插入符号一直存在争议:它的处理方式   版本低于1.0.0。虽然代字号在下面具有相同的行为   1.0.0如上所述,插入符号将0的主要版本视为特殊情况。根据您是否,插入符号扩展到两个不同的范围   还有一个0的次要版本,我们将在下面看到:主要和   MINOR ZERO:^ 0.0.Z→0.0.Z使用插入符号小于   0.1.0根本没有灵活性。只有指定的确切版本才有效。例如,^ 0.0.3仅允许完全允许   版本0.0.3。

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