当我尝试安装软件包时,会发生此错误。
我的节点版本-8.11.3
。
npm-5.6.0
。
npm WARN deprecated minimatch@0.3.0: 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,但这并不能解决问题。
答案 0 :(得分:1)
较早的一次涉及DNS错误配置的中断导致了一些 ISP将npmjs.com缓存为丢失,一种解决方法是使用 第三方DNS提供商(例如Cloudflare或Google), 缓存应在接下来的24小时内清除。
一种解决方法是修改主机文件:
使用其他公共DNS提供商(例如Google)的替代方法 或CloudFlare)是要查找www.npmjs.com的IP地址并添加 它到您的主机文件:
要查找www.npmjs.com的IP,请使用Google Public DNS或带有dig和CloudFlare的DNS的命令行:
浏览www.npmjs.com @ 1.1.1.1
将IP地址添加到您的/ etc / hosts文件中。
请注意:为避免在解析的IP地址发生更改时出现问题,我们 强烈建议您在之后将其从主机文件中删除 周末。
该解决方案的说明和更详细的说明在网站npm上列出。