错误:getaddrinfo ENOTFOUND注册表.npmjs.org注册表.npmjs.org:443 [英] Error : getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443

查看:1649
本文介绍了错误:getaddrinfo ENOTFOUND注册表.npmjs.org注册表.npmjs.org:443的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在公司网络上工作.

尝试安装npm.,但我一次又一次收到此错误.

$ npm install
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program     Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.1.0
npm ERR! npm  v3.8.6
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo

npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org    registry.npmjs.org:443
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is 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! Please include the following file with any support request:
npm ERR!     C:\Angular-test\angular-phonecat\npm-debug.log

也尝试过此操作:npm config set registry https://registry.npmjs.org/

仍然出现相同的错误.

解决方案

尝试的方法:

  1. 确保您已连接互联网:ping 8.8.8.8
  2. 确保您的DNS解析器正常工作:ping www.google.com
  3. 确保您可以访问Registry.npmjs.org:ping registry.npmjs.org
  4. 确保您可以通过https连接.

在浏览器中尝试: https://registry.npmjs.org/

确保您要尝试连接:

  • registry.npmjs.org

而不是:

  • "registry.npmjs.org registry.npmjs.org:443"

或其他由几个主机名组成的奇怪字符串,因为解析器抱怨包含端口号的主机名是很奇怪的,它不需要理会.好的,我测试了一下,对于找不到的主机,它应该看起来像这样.

更新

从您的评论到此答案,即使您无法ping 8.8.8.8,您似乎也没有不直接连接到互联网.

如果使用代理访问Web,则还必须配置npm才能使用它.使用:

npm config set proxy http://example.com:8080
npm config set https-proxy http://example.com:8080

但不使用http://example.com:8080来使用公司中的实际需要-询问某人或查看如何配置您的浏览器.

要在Chrome中查看您的代理配置,请参见.

更新2

如果您可以访问 https://registry.npmjs.org/在您的浏览器中,但您不能运行ping registry.npmjs.org,则这意味着必须将浏览器配置为使用代理,或者必须限制浏览器以外的其他程序使用Internet.

无论如何,您应该向公司中的某人询问,因为很可能您需要使用特定的代理,或者某人需要从您的npm解除限制并允许其访问网络. >

您的计算机上安装的防火墙或网络中的路由器可能会阻止网络访问.不知道您公司的具体配置很难说.

更新3

删除环境变量"https_proxy"(如果有的话)或为"https_proxy"使用正确的值

I am working on a corporate network.

Trying to install npm. But I'm getting this error again and again.

$ npm install
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program     Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.1.0
npm ERR! npm  v3.8.6
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo

npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org    registry.npmjs.org:443
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is 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! Please include the following file with any support request:
npm ERR!     C:\Angular-test\angular-phonecat\npm-debug.log

Tried this also: npm config set registry https://registry.npmjs.org/

Still getting the same error.

解决方案

Things to try:

  1. make sure you have internet connection: ping 8.8.8.8
  2. make sure you have DNS resolver working: ping www.google.com
  3. make sure you can access registry.npmjs.org: ping registry.npmjs.org
  4. make sure you can connect via https.

Try in your browser: https://registry.npmjs.org/

Make sure you are trying to connect to:

  • registry.npmjs.org

and not to:

  • "registry.npmjs.org registry.npmjs.org:443"

or some other weird string composed of few hostnames, because it's weird that the resolver complains about a hostnames that includes a port number, which it shouldn't care about. Ok, I tested and it should look like this for hosts that are not found.

Update

From your comment to this answer it seems that you are not directly connected to the internet if you can't even ping 8.8.8.8.

If you are using a proxy to access the Web, then you also have to configure npm to use it. Use:

npm config set proxy http://example.com:8080
npm config set https-proxy http://example.com:8080

but instead of http://example.com:8080 use what you actually need in your company - ask someone or see how your browser is configured.

To see your proxy configuration in Chrome, see this.

Update 2

If you can access https://registry.npmjs.org/ in your browser but you cannot run ping registry.npmjs.org then it means that your browser must be configured to use a proxy, or other programs than your browser must be restricted from using the internet.

In any case, you should ask someone in your company about it because most likely you either need to use a specific proxy or someone needs to lift the restriction from your npm and allow it to access the network.

The network access can be blocked by a firewall installed on your computer or a router in your network. It's hard to say without knowing the specific configuration in your company.

Update 3

Remove the environment variable "https_proxy" if any or use correct value for "https_proxy"

这篇关于错误:getaddrinfo ENOTFOUND注册表.npmjs.org注册表.npmjs.org:443的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆