我无法安装npm软件包,代理出现问题

问题描述 投票:0回答:1

我试图在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

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

node.js npm proxy centos centos8
1个回答
0
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.