npm install 报错 ECONNREFUSED
在window环境下,使用npm install 命令安装任何框架,都会报如下的错误
16 error code ECONNREFUSED 17 error errno ECONNREFUSED 18 error FetchError: request to http://localhost:4873/vue failed, reason: connect ECONNREFUSED 127.0.0.1:4873 18 error at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\index.js:68:14) 18 error at emitOne (events.js:116:13) 18 error at ClientRequest.emit (events.js:211:7) 18 error at Socket.socketErrorListener (_http_client.js:387:9) 18 error at emitOne (events.js:116:13) 18 error at Socket.emit (events.js:211:7) 18 error at emitErrorNT (internal/streams/destroy.js:64:8) 18 error at _combinedTickCallback (internal/process/next_tick.js:138:11) 18 error at process._tickCallback (internal/process/next_tick.js:180:9) 18 error { FetchError: request to http://localhost:4873/vue failed, reason: connect ECONNREFUSED 127.0.0.1:4873
它总是首先访问localhost:4873,这里肯定是有问题的,因为本地根本没有开启这个端口,
是不是开了什么代理呢,使用npm config get proxy,发现结果为null
最后一番折腾发现原因.npmrc有问题
registry=http://localhost:4873/ #comment ca=null
把它注释掉,再执行安装就可以了