安装 grunt 时出现 NodeJS NPM 代理错误 [英] NodeJS NPM Proxy error when installing grunt
问题描述
当我尝试通过 npm
安装 grunt
时,出现以下错误:
When I'm trying to install grunt
via npm
, I'm getting a following error:
C:Program Files
odejs
ode_modules
pm>npm install -g grunt
npm ERR! network connect ETIMEDOUT
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "grunt"
npm ERR! cwd C:Program Files
odejs
ode_modules
pm
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! syscall connect
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:Program Files
odejs
ode_modules
pm
pm-debug.log
npm ERR! not ok code 0
我正在使用企业代理配置,并且我相信我遇到此错误是因为它的配置.我需要更改什么才能成功安装 grunt?
I´m using enterprise proxy configurations, and I believe that I'm having this error because of its configurations. What do I need to change in order to install grunt successfully?
推荐答案
需要配置npm config文件,这个可以在终端完成:
You need to configure the npm config file, this can be done in the terminal:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
您的错误日志建议查看npm help config",所以我认为问题出在那里.
Your error log suggests to see 'npm help config', so i think the problem comes from there.
如果您想要一个包含更多解释的链接,请参阅此博客条目(还有很多)
If you want a link with more explanation see this blog entry (there are plenty more)
祝你好运!
这篇关于安装 grunt 时出现 NodeJS NPM 代理错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!