npm 对等依赖意外失败

Mar*_*ahn 2 node.js npm

我正在尝试找出对等依赖问题,对我来说一切都很好......

我的package.json有:

, "devDependencies" : {
    "gulp-watchify" : "^0.2.0"
    ,    "watchify" : "^0.10.2"
}
Run Code Online (Sandbox Code Playgroud)

gulp-watchify/package.json具有:

"peerDependencies": {
    "watchify": "^0.6.1"
},
Run Code Online (Sandbox Code Playgroud)

0.10.2斯塔菲斯^0.6.1,不是吗?那么为什么npm抱怨:

npm ERR! peerinvalid The package watchify does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer gulp-watchify@0.2.0 wants watchify@^0.6.1

npm ERR! System Darwin 14.0.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! cwd <path redacted>
npm ERR! node -v v0.11.12
npm ERR! npm -v 1.4.3
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     <path redacted>/npm-debug.log
npm ERR! not ok code 0
Run Code Online (Sandbox Code Playgroud)

???

dyl*_*nts 5

这里的原因0.10.2实际上并不满足^0.6.1,因为0.X.X版本是不稳定版本的特殊 semver 类别。从0.1.Xto移动0.2.X表示发生了重大变化,因此它们不兼容。从semver 文档

^0.1.3 := >=0.1.3-0 <0.2.0-0 “与 0.1.3 兼容”。0.xx 版本是特殊的:第一个非零组件表示潜在的破坏性更改,这意味着插入符运算符匹配从指定版本开始具有相同第一个非零组件的任何版本。

要解决此问题,您可以删除对 的依赖watchify,或将其设置为0.6.X发布行中的某些内容,例如:

, "devDependencies" : {
    "gulp-watchify" : "^0.2.0"
    ,    "watchify" : "^0.6.4"
}
Run Code Online (Sandbox Code Playgroud)