npm install -g grunt-cli在Linux中失败 [英] npm install -g grunt-cli failed in Linux

查看:2281
本文介绍了npm install -g grunt-cli在Linux中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 Linux中运行下一个命令

I try to run next command in Linux:

npm install -g grunt-cli

我得到的消息是:

The message I get is next:

npm http GET https://registry.npmjs.org/grunt-cli

npm ERR! Error: failed to fetch from registry: grunt-cli
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1261:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /usr/local/grunt/npm-debug.log npm

感谢大家的帮忙

推荐答案

我不推荐使用sudo来安装npm(任何sudo npm install),好像需要更新你的仓库,我不确定你正在使用的发行版,但如果你使用debian或ubuntu,你应该这样做:

I don't recommend to use sudo for your npm installations (any sudo npm install), it seems like you need to update your repository, I'm not sure whet distro you are using but if debian or ubuntu you should do something like:

sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

获取更多信息如何从npm安装节点

这篇关于npm install -g grunt-cli在Linux中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆