主机名/ IP与证书的altnames不匹配:“Host:registry.npmjs.org。不在cert的altnames中

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

我尝试安装包时会发生此错误。

我的节点版本 - 8.11.3

npm - 5.6.0

npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm ERR! fetch failed https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz
npm WARN retry will retry, error on last attempt: Error: Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
npm ERR! fetch failed https://registry.npmjs.org/async/-/async-0.2.6.tgz
npm WARN retry will retry, error on last attempt: Error: Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
npm ERR! fetch failed https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz
npm WARN retry will retry, error on last attempt: Error: Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
npm ERR! fetch failed https://registry.npmjs.org/async/-/async-0.2.6.tgz
npm WARN retry will retry, error on last attempt: Error: Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
npm ERR! fetch failed https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/async/-/async-0.2.6.tgz
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Users\\Pawel\\AppData\\Local\\atom\\app-1.30.0\\resources\\app\\apm\\bin\\node.exe" "C:\\Users\\Pawel\\AppData\\Local\\atom\\app-1.30.0\\resources\\app\\apm\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "C:\\Users\\Pawel\\.atom\\.apm\\.apmrc" "--userconfig" "C:\\Users\\Pawel\\.atom\\.apmrc" "install" "C:\\Users\\Pawel\\AppData\\Local\\Temp\\d-11881-6496-2xm5hl.fyhtcsor\\package.tgz" "--runtime=electron" "--target=2.0.5" "--arch=ia32" "--global-style"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10

npm ERR! Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Pawel\AppData\Local\Temp\apm-install-dir-11881-6496-1hnnd3v.aeg4xwdn29\npm-debug.log

编辑:

我将minimatch更新到3.0.4,它没有解决问题。

npm atom-editor npm-install
1个回答
1
投票

之前涉及DNS配置错误的中断导致某些ISP将npmjs.com缓存为缺失,解决方法是使用第三方DNS提供商(如Cloudflare或Google),受影响的缓存应在接下来的24小时内清除。

解决方法是修改主机文件:

使用其他公共DNS提供商(如Google或CloudFlare)的替代方法是查找www.npmjs.com的IP地址并将其添加到您的hosts文件中:

  1. 要查找www.npmjs.com的IP,请使用Google Public DNS或dig和CloudFlare DNS的命令行: 挖掘www.npmjs.com @ 1.1.1.1
  2. 将IP地址添加到/ etc / hosts文件中。

请注意:为避免在已解析的IP地址发生变化时出现问题,我们强烈建议您在周末之后从hosts文件中删除此条目。

有关解决方案的说明和更详细的说明,请参见网站npm

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