npmatom-editornpm-install

Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames


This error occurs when I try to install package.

My node version - 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

EDIT:

I update minimatch to 3.0.4, it's didin't resolve the problem.


Solution

  • An earlier outage involving a DNS misconfiguration has lead to some ISPs caching npmjs.com as missing, a workaround for this is to use a third party DNS provider such as Cloudflare or Google, the affected caches should clear within the next 24 hours.

    A workaround is to modify your hosts file:

    An alternative to using a different public DNS provider (like Google or CloudFlare) is to look up an IP address for www.npmjs.com and add it to your hosts file:

    1. To look up an IP for www.npmjs.com, either use Google Public DNS or the command line with dig and CloudFlare's DNS:

      dig www.npmjs.com @1.1.1.1

    2. Add the IP address to your /etc/hosts file.

    Please note: to avoid issues if the resolved IP address changes, we strongly advise that you remove this entry from your hosts file after the weekend.

    Instructions for the solution and a more detailed description are listed on the website npm.