0

我尝试在 Centos8 上使用 npm 安装一些软件包,但我遇到了这个问题:

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/ejs failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-09T16_50_40_483Z-debug.log

我改变了 yum.conf 但喜欢:


gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
#proxy=http://10.30.17.74:443

但我遇到了同样的问题,请帮助我。

4

1 回答 1

0

npm install通过命令行调用时尝试传递代理设置,如下所示:

http_proxy=http://<yourproxy>:<proxyport> https_proxy=<yourproxy>:<proxy port> npm install <package>

于 2020-01-09T22:02:53.330 回答