记一次npm install 报RequestError: connect ETIMEDOUT 20.205.243.166:443和RequestError: socket hang up

今早安装 electron 时突然报

RequestError: connect ETIMEDOUT 20.205.243.166:443

然后尝试
ping github.com
超时了
记一次npm install 报RequestError: connect ETIMEDOUT 20.205.243.166:443和RequestError: socket hang up_第1张图片
之后去
http://ping.chinaz.com/https://github.com
找到一个韩国的 host
修改本地 host 文件

52.78.231.108 github.com 

再次安装报错:

RequestError: socket hang up

然后修改registry

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

安装成功
记一次npm install 报RequestError: connect ETIMEDOUT 20.205.243.166:443和RequestError: socket hang up_第2张图片

你可能感兴趣的:(electron,npm,前端,node.js)