Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

node.js - I am facing a certificate error while trying to install NPM packages on Windows. I am using Node v10.9.0

npm ERR! code ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! errno ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! request to https://registry.npmjs.org/http-server failed, reason: 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It seems that it's a real problem on the NPM servers. I see the same error when navigating to https://registry.npmjs.org/http-server in a browser. The server indeed doesn't have a valid certificate. Nothing Windows-specific.

NPM reports there's an issue with incorrect DNS information being cached, here: https://status.npmjs.org/incidents/v22ffls5cd6h

Until the cache clears up, they suggest doing the following:

  1. dig registry.npmjs.com @1.1.1.1
  2. Add the IP found to your /etc/hosts file.

Update: A bit unrelated, for ones using yarn: Yarn's mirror of the NPM registry seems to be affected by this problem too, so it seems that at the moment all we can do is wait until the issue resolves itself or the Yarn team applies a workaround on the server.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...