npm install gulp-cli -g时npm ERR! code ECONNREFUSED


F:\web\001js_learn\jQuery\07GULP\src>npm install gulp-cli -g
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to http://registry.npm.taobao.org/gulp-cli failed, reason: connect ECONNREFUSED 127.0.0.1:1080
npm ERR! at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
npm ERR! at ClientRequest.emit (events.js:315:20)
npm ERR! at Socket.socketErrorListener (_http_client.js:426:9)
npm ERR! at Socket.emit (events.js:315:20)
npm ERR! at emitErrorNT (internal/streams/destroy.js:92:8)
npm ERR! at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
npm ERR! at processTicksAndRejections (internal/process/task_queues.js:84:21)
npm ERR! FetchError: request to http://registry.npm.taobao.org/gulp-cli failed, reason: connect ECONNREFUSED 127.0.0.1:1080
npm ERR! at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
npm ERR! at ClientRequest.emit (events.js:315:20)
npm ERR! at Socket.socketErrorListener (_http_client.js:426:9)
npm ERR! at Socket.emit (events.js:315:20)
npm ERR! at emitErrorNT (internal/streams/destroy.js:92:8)
npm ERR! at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
npm ERR! at processTicksAndRejections (internal/process/task_queues.js:84:21) {
npm ERR! type: 'system',
npm ERR! errno: 'ECONNREFUSED',
npm ERR! code: 'ECONNREFUSED'
npm ERR! }
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! A complete log of this run can be found in:
npm ERR! C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2020-06-14T08_32_49_976Z-debug.log

 

 

解决办法:

1、执行:

 

  1.   npm config get proxy
  2.   npm config get https-proxy

如果返回值不为null,继续执行:

 

 

  1.   npm config set proxy null
  2.   npm config set https-proxy null

2、执行:

 

 

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

3、直接编辑c盘下的.npmrc文件,将registry的值修改为:

registry = http://registry.cnpmjs.org
上一篇:面试常考--socket常见错误


下一篇:FileZilla尝试连接“ECONNREFUSED - 连接被服务器拒绝”失败