錯誤代碼如下
request to https://registry.npm.taobao.org/yrm failed, reason: getaddrinfo EAI_AGAIN registry.npm.taobao.org registry.npm.taobao.org:443
嘗試 ping baidu.com ,失敗
sudo vi /etc/nsswitch.conf
hosts: files dns
networks: files
改成:
hosts: files dns wins
networks: files
如果不一樣的話,就在hosts:原來那行後面加個wins 就行了 (參考 :Linux Ubuntu 能PING IP但不能PING主機域名的解決方法 )
如果還是不能ping 域名
DNS 解析的問題
sudo vim /etc/resolv.conf
nameserver 8.8.8.8 //google的域名解析服務器 nameserver 114.114.114.114 //聯通的域名解析服務器
重試 ping baidu.com 成功
重試 npm install 成功