node.js - Windows 下的 Grunt cli 安装错误

标签 node.js gruntjs

我正在尝试使用命令“npm install -g grunt-cli”为 Windows 安装 Grunt cli,收到下面提到的错误消息,请就此提出建议。

**

npm ERR! Error: connect ECONNREFUSED
npm ERR!     at errnoException (net.js:904:11)
npm ERR!     at Object.afterConnect [as oncomplete] (net.js:895:19)
npm ERR!  { [Error: connect ECONNREFUSED]
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   syscall: 'connect' }
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "grunt-cli"
npm ERR! cwd C:\Users\M1022339
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! syscall connect
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! stack Error: connect ECONNREFUSED
npm ERR! stack     at errnoException (net.js:904:11)
npm ERR! stack     at Object.afterConnect [as oncomplete] (net.js:895:19)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\M1022339\npm-debug.log
npm ERR! not ok code 0

**

谢谢, 达南贾亚

最佳答案

已解决:

我们需要为命令窗口设置代理服务器 URL。

set HTTP_PROXY=http ://用户名:密码@proxy_server_IP:端口

例如:设置 HTTP_PROXY= http://xyz:Abc123@ip:port

设置后运行“npm install -g grunt-cli”命令

关于node.js - Windows 下的 Grunt cli 安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27242097/

相关文章:

javascript - 在 nodejs 日期对象中设置日期将日期显示为不同的值

node.js - 无法使用 npm 和 shell 下载 Node 包

angularjs - 是否有任何自动化的 [grunt] 任务可以在 index.html 中为 CSS/JS 文件添加 CDN?

javascript - Grunt jasmine 测试在终端中失败但在浏览器中失败

javascript - Gruntfile.js 中的 {,*/}*.* 是什么意思

javascript - 如何从我的机器上提供 HTML + JS + CSS webapp 以便其他人可以查看它?

javascript - 序列化原始 findAll 返回不需要的 ID 列

node.js - 使用findOneAndUpdate如何检查文档是否被插入或更新?

node.js - 如何修复 "MongoError: database names cannot contain the character '/' "

java - 设置 JAVA_HOME 的 Grunt 任务