node.js - 错误:对 https://registry.npmjs.org/yarn 的网络请求失败,原因:getaddrinfo ENOTFOUND example.com example.com:8080
问题描述
试图运行npm install -g "something"
。但我收到了这个错误。
我正在使用 Windows 7:
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/yarn failed, reason:
getaddrinfo ENOTFOUND example.com example.com:8080
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! C:\Users\User\AppData\Roaming\npm-cache\_logs\2019-03-
01T13_13_42_425Z-debug.log
当我在 Chrome https://registry.npmjs.org/yarn上打开此 URL 时,我看到了文件内容
谁能帮我解决这个问题?
解决方案
经过大量研究,我终于找到了解决这个问题的方法。
从一开始我就试图用 npm 删除代理
npm config rm proxy
npm config rm https-proxy
但由于某种原因,它没有成功。
我在这个文件中找到了代理 url
C:\Users\User\.npmrc
https-proxy=http://example.com:8080
proxy=http://example.com:8080/
手动删除这些解决了这个问题,我可以使用 npm 安装任何应用程序。
推荐阅读
- r - 如何避免数据框中多行的*乘法循环
- postgresql - BRIN 索引创建
- rust - 为什么我可以毫无错误地转换为另一个引用结构?
- react-native - TypeError:未定义不是对象(评估'style.width')
- for-loop - FileOutputStream - 二进制 I/O 和制作 int 数据 10 Java
- regex - 条件公式:如果单元格包含则显示文本
- c++ - make: 'all' 错误无能为力
- r - 在 ggplot2 中创建条形图并根据来自另一个数据框的标签添加点
- python - Windows 上的 Pipenv 因安装 wrapt 错误而失败(python 3.6.8)
- html - 可变高度 div 内的静止图像