npm安装不起作用

时间:2014-06-16 13:17:23

标签: node.js npm gulp

OS windows 7 64bit

当我使用npm install gulp时,npm不起作用。

我很困惑......

错误代码:

npm ERR! Error: connect ECONNREFUSED
npm ERR!     at errnoException (net.js:878:11)
npm ERR!     at Object.afterConnect [as oncomplete] (net.js:869: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.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "nodemailer"
npm ERR! cwd C:\Users\yy
npm ERR! node -v v0.10.2
npm ERR! npm -v 1.2.15
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:878:11)
npm ERR! stack     at Object.afterConnect [as oncomplete] (net.js:869:19)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\yy\npm-debug.log
npm ERR! not ok code 0

提前感谢!

1 个答案:

答案 0 :(得分:24)

看起来你是代理人的背后。要通过它,您必须将其配置为:

npm config set proxy http://myproxyblabla:myport
npm config set https-proxy http://myproxyblabla:myport

https的问题通过以下方式解决:

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