linux (wsl) npm 没法安装包

错误代码以下html

 

 

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 ,失败  npm

sudo vi /etc/nsswitch.confvim

hosts: files dns服务器

networks: filespost

改为:google

hosts: files dns winsurl

networks: filesspa

若是不同的话,就在hosts:原来那行后面加个wins 就好了 (参考 :Linux Ubuntu 能PING IP但不能PING主机域名的解决方法 )code

 

若是仍是不能ping 域名server

DNS 解析的问题

sudo vim /etc/resolv.conf

 

nameserver 8.8.8.8      //google的域名解析服务器
nameserver 114.114.114.114   //联通的域名解析服务器

 

重试 ping baidu.com  成功

重试 npm install 成功

相关文章
相关标签/搜索