使用npm安装express时终端中出现ECONNREFUSED错误

时间:2016-04-04 08:04:51

标签: node.js npm

on node js command prompt i am getting following error while installing express

我正在运行以下命令 npm install express

1 个答案:

答案 0 :(得分:0)

在诊断方面,错误信息非常清楚。 199.27.76.162是npmjs.org IP地址之一。使用ECONNREFUSED失败的net.js模块意味着从NPM到npmjs.org服务器没有连接。

您应该尝试对该IP地址ping进行操作,并验证与该服务器的一般连接。

如果您从终端运行ping 199.27.76.162,您应该得到一个确认存在连接的输出:

PING 199.27.76.162 (199.27.76.162): 56 data bytes
64 bytes from 199.27.76.162: icmp_seq=0 ttl=51 time=131.795 ms
64 bytes from 199.27.76.162: icmp_seq=1 ttl=51 time=138.581 ms
64 bytes from 199.27.76.162: icmp_seq=2 ttl=51 time=132.076 ms
64 bytes from 199.27.76.162: icmp_seq=3 ttl=51 time=130.904 ms
64 bytes from 199.27.76.162: icmp_seq=4 ttl=51 time=132.261 ms
64 bytes from 199.27.76.162: icmp_seq=5 ttl=51 time=131.167 ms

如果您使用proxy,请务必正确设置npmhttps://docs.npmjs.com/misc/config

根据所有证据,问题似乎与您的网络设置有关。