环境
阿里云 centos7
node v8.11.3
npm 5.6.0
错误
npm update
解决
ping registry.npmjs.org
发现https://registry.npmjs.org 网址ping不通
查看/etc/resolv.conf
vim /etc/resolv.conf
发现这个文件的dns服务器被修改为了 127.0.0.1
参考其他阿里云服务器的dns服务器配置,将其修改如下
options timeout: attempts: rotate single-request-reopen
; generated by /usr/sbin/dhclient-script
nameserver 100.100.2.138
nameserver 100.100.2.136
search localdomain
重新ping registry.npmjs.org 成功
ping registry.npmjs.org
执行npm update也成功