尝试使用npm安装任何内容时出现以下错误

时间:2015-08-29 14:24:46

标签: terminal npm

每当我尝试安装软件包时,都会收到此错误:

/usr/local/bin/karma -> /usr/local/lib/node_modules/karma/bin/karma
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "karma"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package karma does not satisfy its siblings'         peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-karma@0.6.2 wants karma@~0.10.0
npm ERR! peerinvalid Peer karma-html2js-preprocessor@0.1.0 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-mocha@0.1.10 wants karma@>=0.12.8
npm ERR! peerinvalid Peer karma-phantomjs-launcher@0.1.4 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-script-launcher@0.1.0 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-jasmine@0.1.6 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-requirejs@0.2.2 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-coffee-preprocessor@0.1.3 wants karma@>=0.9

npm ERR! Please include the following file with any support request:
npm ERR!     /Applications/Xcode-beta.app/Contents/Developer/npm-debug.log

我尝试卸载/重新安装npm,节点和业力但无济于事

也尝试过:

rm -rf /usr/local/lib/node_modles/karma-*

npm cache clean -g

1 个答案:

答案 0 :(得分:0)

我对发电机业有同样的错误,这就是我所做的:

运行:

[sudo] npm -g ls --depth=0

它会显示模块列表,如下所示:

├── bower@1.5.2
├── david@6.2.0
├── express@4.13.3
├── express-generator@4.13.1
├── generator-karma@1.0.0 peer invalid
├── grunt@0.4.5
├── grunt-cli@0.1.13
├── gulp@3.9.0
├── ionic@1.6.4
├── jscs@2.1.1
├── jshint@2.8.0
├── less@2.5.1
├── mean-cli@0.10.14
├── mocha@2.3.0
├── node-inspector@0.12.3
├── nodemon@1.4.1
├── nodesql@0.2.4
├── npm@2.11.3
├── pm2@0.14.7
├── sass@0.5.0
├── sqlite3@3.0.10
├── todo@1.1.0
└── yo@1.4.7

请参阅此行:generator-karma@1.0.0 对等无效

这是有问题的,你应该在输出中看到类似的东西。您可以尝试使用[sudo] npm -g update generator-karma进行更新,也可以使用[sudo] npm -g uninstall generator-karma将其删除,并在第一时间执行您想要执行的操作。

之后,重新安装它或者像这样离开它取决于你。