在 npm 包全局安装上获取“npm ERR!code EPEERINVALID”

2024-02-10

每当我安装任何全局包时,我都会收到此错误。

错误:- 在 npm 包全局安装上

例如:-

robins@robins-H61MLV3:~$ sudo npm install -g jshint

/usr/bin/jshint -> /usr/lib/node_modules/jshint/bin/jshint
npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "jshint"
npm ERR! node v0.10.25
npm ERR! npm  v2.13.2
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package [email protected] /cdn-cgi/l/email-protection does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] /cdn-cgi/l/email-protection wants karma@~0.10.0
npm ERR! peerinvalid Peer [email protected] /cdn-cgi/l/email-protection wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] /cdn-cgi/l/email-protection wants karma@>=0.12.8
npm ERR! peerinvalid Peer [email protected] /cdn-cgi/l/email-protection wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] /cdn-cgi/l/email-protection wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] /cdn-cgi/l/email-protection wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] /cdn-cgi/l/email-protection wants karma@>=0.9
npm ERR! peerinvalid Peer [email protected] /cdn-cgi/l/email-protection wants karma@>=0.9

到目前为止我已经尝试过的

我尝试过更新全局业力及其相关模块,但没有成功。我也尝试卸载 karma 模块,但问题仍然存在。

sudo npm uninstall -g  karma grunt-karma karma-html2js-preprocessor  karma-mocha karma-phantomjs-launcher karma-script-launcher  karma-jasmine  karma-requirejs karma-coffee-preprocessor

看起来 karma 对其他可用(全局)但较旧的模块有一些依赖。 您需要使用 npm update -g 更新全局包

npm update -g

基本上“npm update -g”只是更新所有全局包。 “全部”是因为没有提供包名称,“全局”是因为“-g”开关。

我的建议是首先更新所有全局包,然后尝试再次安装 jshint。

sudo npm install -g jshint
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 npm 包全局安装上获取“npm ERR!code EPEERINVALID” 的相关文章

随机推荐