node.js 错误 npm 安装

node.js error npm install

每当我尝试在 node.js 中导入项目时,我似乎无法让它工作。 当我尝试安装时它给出了错误。 我试过使用 cmd,cmd 作为管理员,cmd 用于节点和 git bash。他们都给出了同样的错误,我似乎无法弄清楚这是什么意思。

这是我使用 "npm install express -g"

时得到的输出示例

c:\wamp\wwwimda\webtech2\eindopdracht>npm install express -g npm WARN unmet dependency C:\Users\Maïteh\AppData\Roaming\npm\node_modules\phone gap\node_modules\phonegap-build requires colors@'0.6.x' but will load npm WARN unmet dependency C:\Users\Maïteh\AppData\Roaming\npm\node_modules\phone gap\node_modules\colors, npm WARN unmet dependency which is version 0.6.0-1 npm WARN unmet dependency C:\Users\Maïteh\AppData\Roaming\npm\node_modules\phone gap\node_modules\prompt\node_modules\winston requires colors@'0.x.x' but will lo ad npm WARN unmet dependency C:\Users\Maïteh\AppData\Roaming\npm\node_modules\phone gap\node_modules\colors, npm WARN unmet dependency which is version 0.6.0-1 npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs \node_modules\npm\bin\npm-cli.js" "install" "express" "-g" npm ERR! node v0.12.0 npm ERR! npm v2.5.1 npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package mongoose does not satisfy its siblings' peerDep endencies requirements! npm ERR! peerinvalid Peer node-restful@0.1.18 wants mongoose@~3

npm ERR! Please include the following file with any support request: npm ERR! c:\wamp\wwwimda\webtech2\eindopdracht\npm-debug.log

c:\wamp\wwwimda\webtech2\eindopdracht>

我尝试 "npm install -g"

时遇到同样的错误

this screenshot, you can see that node-restful expects a mongoose of version ~3, but from this screenshot,你可以看到你有4.0.1版本的mongoose!直接的解决办法是将package.json文件中mongoose的版本改为3.9.7,然后重新运行npm install(去掉-g)。这就是我在本地工作的方式。

如果您想知道发生这种情况的原因,您可以阅读有关 Peer Dependencies 的更多信息。

干杯, 布伦南