8

It had been a while since I tried setting up a new Angular app -- because I've been working on an existing one for several months.

Today, upon trying to install a new Angular app via the terminal in my Mac, it ran really slowly, and then resulted in this err:

npm ERR! code ERR_TLS_CERT_ALTNAME_INVALID

npm ERR! Hostname/IP does not 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

How do I address this issue?

Muirik
  • 6,049
  • 7
  • 58
  • 116

4 Answers4

9

run npm config set strict-ssl false and re-run ng new appName

if it doesn't work try to run npm config set registry "http://registry.npmjs.org"

Edit

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.

https://status.npmjs.org/incidents/v22ffls5cd6h

Ayoub k
  • 7,788
  • 9
  • 34
  • 57
  • @Ayoub_k, I tried, `npm config set strict-ssl false` and it produced this error: `registry error parsing json`. So then I tried `npm config set registry http://registry.npmjs.org/` and got the same error again. Ideas? – Muirik Sep 01 '18 at 14:39
  • i think your npm version is too old. run `npm cache clean` and `npm install npm -g` after that try to run one of the commands in the answer. – Ayoub k Sep 01 '18 at 14:43
  • Okay, will try that. Thanks. – Muirik Sep 01 '18 at 14:44
  • `Muir-Air:~ muir$ sudo npm cache clean Password: ************ Muir-Air:~ muir$ sudo npm install npm -g npm ERR! registry error parsing json ⸨░░░░░░░░░░░░░░░░░░⸩ ⠹ normalizeTree: ERR! registry error parsing json` – Muirik Sep 01 '18 at 14:45
  • try : `sudo npm cache clean --force` – Ayoub k Sep 01 '18 at 14:46
  • here's some suggestion, one of them may works: https://stackoverflow.com/questions/30787702/npm-err-registry-error-parsing-json-while-trying-to-install-cordova-for-ionic and https://github.com/npm/npm/issues/8536 – Ayoub k Sep 01 '18 at 14:48
  • It seems a npm related issue, check this out, https://stackoverflow.com/questions/52128026/npm-died-completely-err-tls-cert-altname-invalid-hostname-ip-does-not-match-ce/52129462#52129462 – Carlos Rufo Sep 01 '18 at 15:42
  • Thanks, @Ayoub. As you suggested in your last edit, it does seem like this problem resolved on its own. By the end of the day the problem seemed to have resolved itself. – Muirik Sep 02 '18 at 19:42
1

I think its npmjs DNS Problem now

Try adding

104.16.16.35 registry.npmjs.org

to your etc\host file with admin right using notepad

Remove it when it is resolved

AllStackDev
  • 65
  • 1
  • 8
0

npm config set strict-ssl false Work for me fine

lukas5895
  • 1
  • 2
-1

yes it is working.

MAC => vim /etc/hosts

Thanks