安装grunt / latest版本时出现npm错误

时间:2016-06-13 11:13:57

标签: android node.js npm gruntjs npm-install

npm 升级到最新版本或使用命令提示符安装 grunt 时,我收到以下异常。

C:\Users\username>npm install npm@latest
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "npm@latest"
npm ERR! node v4.4.5
npm ERR! npm  v2.15.5
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect

npm ERR! network connect ETIMEDOUT 103.245.222.162:443
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 settin
gs.
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! Please include the following file with any support request:
npm ERR!     D:\Users\username\npm-debug.log

我尝试了以下命令来安装最新版本的npm

npm install npm@latest

安装grunt

npm install -g grunt-cli

对于两者,我收到上述错误。有人可以帮我解决这个问题。

更新

我尝试了以下内容。我已配置代理地址,然后尝试安装grunt。

对于HTTP:

npm config set proxy http://proxy_host:port

对于HTTPS:

npm config set https-proxy http://proxy.company.com:8080

但是,它仍然显示相同的错误。

1 个答案:

答案 0 :(得分:0)

这个问题解决了我的问题。

npm config set registry "http://registry.npmjs.org/"  

然后,安装了grunt并且它工作了!

相关问题