npm ERR!对https://registry.npmjs.org/ngx-pagination的请求失败,原因:getaddrinfo EAI_AGAIN Registry.npmjs.org Registry.npmjs.org:443

时间:2019-06-19 11:31:11

标签: npm-install

在安装任何npm软件包时,每次都会遇到相同的错误。

试图删除并设置代理,但没有用。

tabish @ appventurez:〜/ Documents / projects / InstaCEI / InstaCEI_Website $ sudo npm i ngx-pagination --save npm ERR!代码EAI_AGAIN npm ERR! errno EAI_AGAIN npm ERR!对https://registry.npmjs.org/ngx-pagination的请求失败,原因:getaddrinfo EAI_AGAIN Registry.npmjs.org Registry.npmjs.org:443

npm错误!可以在以下位置找到此运行的完整日志: npm ERR! /home/tabish/.npm/_logs/2019-06-19T11_27_35_023Z-debug.log

tabish @ appventurez:〜/ Documents / projects / InstaCEI / InstaCEI_Website $ sudo npm i ngx-pagination --save npm ERR!代码EAI_AGAIN npm ERR! errno EAI_AGAIN npm ERR!对https://registry.npmjs.org/ngx-pagination的请求失败,原因:getaddrinfo EAI_AGAIN Registry.npmjs.org Registry.npmjs.org:443

npm错误!可以在以下位置找到此运行的完整日志: npm ERR! /home/tabish/.npm/_logs/2019-06-19T11_27_35_023Z-debug.log

1 个答案:

答案 0 :(得分:0)

一个原因是关于您的IP地址设置的。 检查ip addrpingnetplan是否为Ubuntu。

在我的示例中,我设置了Ubuntu(18.04)VM的静态IP,但是我忘记了DNS。 然后我得到了和你完全一样的错误。

我通过如下更改文件/etc/netplan/50-cloud-init.yaml来解决此问题:

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
         ens33:
                 addresses: [192.168.233.132/24]
                 dhcp4: no
                 gateway4: 192.168.233.2
                 optional: true
                 nameservers:
                         addresses: [223.5.5.5, 8.8.8.8]
    version: 2