读取 peerinvalid 输出
Reading peerinvalid Output
从 vanilla npm install
中获取以下输出:
npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-tslint@2.5.0 wants grunt@~0.4.5
npm ERR! peerinvalid Peer grunt-processhtml@0.3.13 wants grunt@>=0.4.x
npm ERR! peerinvalid Peer grunt-contrib-copy@0.8.2 wants grunt@>=0.4.0
npm ERR! peerinvalid Peer grunt-bower-install@1.6.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-connect@0.11.2 wants grunt@>=0.4.0
npm ERR! peerinvalid Peer grunt-contrib-watch@0.4.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-lesslint@1.4.1 wants grunt@~0.4.5
npm ERR! peerinvalid Peer grunt-typescript@0.8.0 wants grunt@~0.4.5
npm ERR! peerinvalid Peer grunt-bower-concat@0.6.0 wants grunt@~0.4.0
如何从 package.json 诊断依赖版本问题,它有以下依赖:
"grunt": "0.4.5",
"grunt-bower-concat": "^0.6.0",
"grunt-bower-install": "^1.6.0",
"grunt-bower-task": "^0.4.0",
"grunt-contrib-connect": "0.11.2",
"grunt-contrib-copy": "^0.8.2",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-watch": "0.4.0",
"grunt-processhtml": "^0.3.8",
"grunt-lesslint": "^1.4.0",
"grunt-tslint": "^2.4.0",
"grunt-typescript": "^0.8.0",
"matchdep": "~0.1.1",
"tslint": "^2.4.2"
peerDependencies 具有以下不同的规则:
~0.4.5 :: True, grunt dependency is hard-coded as exactly 0.4.5
>=0.4.x :: True, 0.4.5 >= 0.4.x
>=0.4.0 :: True, 0.4.5 >= 0.4.0
~0.4.0 :: True, 0.4.5 is a patch of 0.4.0
所有这些都通过了 grunt
依赖项的规定版本。为什么 NPM 仍然抱怨?
执行 npm install
时,它将评估当前安装的 软件包的兼容性 。
从空白 node_modules
目录开始,具有上述依赖项的 package.json
将成功安装。
此问题的根本原因是手动安装了更高版本的 grunt:
# First NPM install, works sucecssfully
npm install
# Upgrade to later version of grunt, note we're not adding --save
npm install grunt@1.0.0
# NPM install now fails with incompatibility error
npm install
在这种情况下,package.json
文件仍然显示 0.4.5
版本的 grunt,但安装的模块仍然是 1.0.0
。
要找到已安装模块的列表,应该查阅 npm list
从 vanilla npm install
中获取以下输出:
npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-tslint@2.5.0 wants grunt@~0.4.5
npm ERR! peerinvalid Peer grunt-processhtml@0.3.13 wants grunt@>=0.4.x
npm ERR! peerinvalid Peer grunt-contrib-copy@0.8.2 wants grunt@>=0.4.0
npm ERR! peerinvalid Peer grunt-bower-install@1.6.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-connect@0.11.2 wants grunt@>=0.4.0
npm ERR! peerinvalid Peer grunt-contrib-watch@0.4.0 wants grunt@~0.4.0
npm ERR! peerinvalid Peer grunt-lesslint@1.4.1 wants grunt@~0.4.5
npm ERR! peerinvalid Peer grunt-typescript@0.8.0 wants grunt@~0.4.5
npm ERR! peerinvalid Peer grunt-bower-concat@0.6.0 wants grunt@~0.4.0
如何从 package.json 诊断依赖版本问题,它有以下依赖:
"grunt": "0.4.5",
"grunt-bower-concat": "^0.6.0",
"grunt-bower-install": "^1.6.0",
"grunt-bower-task": "^0.4.0",
"grunt-contrib-connect": "0.11.2",
"grunt-contrib-copy": "^0.8.2",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-watch": "0.4.0",
"grunt-processhtml": "^0.3.8",
"grunt-lesslint": "^1.4.0",
"grunt-tslint": "^2.4.0",
"grunt-typescript": "^0.8.0",
"matchdep": "~0.1.1",
"tslint": "^2.4.2"
peerDependencies 具有以下不同的规则:
~0.4.5 :: True, grunt dependency is hard-coded as exactly 0.4.5
>=0.4.x :: True, 0.4.5 >= 0.4.x
>=0.4.0 :: True, 0.4.5 >= 0.4.0
~0.4.0 :: True, 0.4.5 is a patch of 0.4.0
所有这些都通过了 grunt
依赖项的规定版本。为什么 NPM 仍然抱怨?
执行 npm install
时,它将评估当前安装的 软件包的兼容性 。
从空白 node_modules
目录开始,具有上述依赖项的 package.json
将成功安装。
此问题的根本原因是手动安装了更高版本的 grunt:
# First NPM install, works sucecssfully
npm install
# Upgrade to later version of grunt, note we're not adding --save
npm install grunt@1.0.0
# NPM install now fails with incompatibility error
npm install
在这种情况下,package.json
文件仍然显示 0.4.5
版本的 grunt,但安装的模块仍然是 1.0.0
。
要找到已安装模块的列表,应该查阅 npm list