【问题标题】:I can't install npm package, problems with proxy我无法安装 npm 包,代理问题
【发布时间】:2020-04-27 13:49:01
【问题描述】:

我尝试在 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】:

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

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

    【讨论】:

    • 谢谢,这对我有帮助。
    猜你喜欢
    • 1970-01-01
    • 2016-03-13
    • 2014-12-22
    • 1970-01-01
    • 2017-12-12
    • 1970-01-01
    • 2020-12-03
    相关资源
    最近更新 更多