npm - 我无法安装任何 npm 包
问题描述
每次尝试安装 npm 包时,我都会收到此错误:
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/json-server failed, reason: getaddrinfo ENOTFOUND proxy.company.com proxy.company.com:8181
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! ```
解决方案
似乎您错误地配置了您的代理信息,以下是如何从您的 cli 为 npm 配置它:
npm config set proxy http://{user}:{password}@{proxy-url}:{proxy-port}
npm config set https-proxy http://{user}:{password}@{proxy-url}:{proxy-port}
如果您不在代理后面:
npm config delete proxy
npm config delete https-proxy
希望它可以帮助。
推荐阅读
- c# - 模型和表上的值一直显示为空
- css - CSS选择所有后代中的最后一个元素
- vb.net - BackgroundWorker 中的 TWAIN 事件
- html - Angular:在 html 模板中使用三元运算符
- javascript - 下个月的时刻检查
- typescript - 时刻:格式化日期时添加+1个月
- c - 进程可以读取自己的标准输出/标准错误吗?
- migrate - django.db.utils.ProgrammingError:在我尝试将 Hstorefield 添加到我的模型后无法调整类型“dict”
- python - 如何从每个 URL 读取特定列并为多个 URL 重复它
- php - 当所有单独的主题颜色都定义为文件中的 PHP 变量时,如何使用 PHP 更改主题?