解决网络隧道套接字无法建立错误

时间:2016-08-16 06:30:48

标签: node.js npm

在尝试安装node-inspector时,我收到错误:

npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/home/hira/.nvm/versions/node/v4.4.7/bin/node" "/home/hira/.nvm/versions/node/v4.4.7/bin/npm" "install" "-g" "node-inspector"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! code ECONNRESET

npm ERR! network tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:5002
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 settings.
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:

我基本上有一个基于节点thin模块的项目,它在127.0.0.1:5002上运行了一个http / https mitm代理

在这个问题上阅读一些答案,我尝试使用以下方法删除代理设置:

npm config rm proxy
npm config rm https-proxy

以及

npm config set proxy = null

因此,当我执行npm config ls -l时,它将两个设置都显示为null。但是,它还是拒绝安装。我甚至试图删除我的系统网络代理设置。

有人可以帮忙解决这个问题吗?我在Virtualbox上的Ubuntu 16.04上运行节点v4.4.7和npm版本2.15.8。感谢。

1 个答案:

答案 0 :(得分:3)

正如评论中的robertklepQPTR所示,删除环境变量为我解决了这个问题

HTTP_PROXY

https_proxy

HTTPS_PROXY

HTTP_PROXY