Npm 读取有效输出

Npm 读取有效输出,npm,npm-install,Npm,Npm Install,从vanillanpm安装获取以下输出: 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@&

从vanilla
npm安装获取以下输出:

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诊断依赖项版本问题,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安装时,它将评估当前安装的软件包的兼容性

从空白的
节点\u 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列表