【报错】Error: https://registry.npmmirror.com.tgz: tunneling socket could not be established, cause=co..
报错信息:
Error: https://registry.npmmirror.com/bytes/download/bytes-3.0.0.tgz: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:31181
详细报错:
Error: https://registry.npmmirror.com/bytes/download/bytes-3.0.0.tgz: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:31181
at ClientRequest.onError (E:\nvm\v8.9.3\node_modules\yarn\lib\cli.js:152151:17)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at Socket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
查看镜像
npm config get registry //查看
yarn config get registry
// https://registry.npm.taobao.org/
切换淘宝镜像
npm config set registry https://registry.npm.taobao.org
yarn config set registry https://registry.npm.taobao.org
我一开始以为是镜像源出错,就一直在更换镜像源,结果可想而知,依旧没有解决错误,在不断查找资料发现自己的方向就错了,这个问题的核心错误信息是:
ECONNREFUSED 127.0.0.1:31181
我最近科学与上网,可能改到了什么东西,所以先查询重置下。
首先可以查看一下npm的代理配置:
npm config get https-proxy
http://127.0.0.1:31181/
然后查看本地的端口没有对应的服务开启:
netstat -ano
1.清空相关代理,http-proxy和proxy
npm config delete https-proxy
npm config delete proxy
2.查看配置代理的结果
npm config get proxy
//返回null
npm config get https-proxy
最后,试试看。可以了。
如果还不行,就清下yarn的缓存
yarn cache clean
``
一杯茶,一包烟,一行代码打一天。