NPM not installing package. Hostname/IP address doesn't match certificate's altnames:

前端 未结 3 1811
长情又很酷
长情又很酷 2021-02-03 18:06

For a solution, see below

It was working yesterday, but I don\'t know what happened to it.

NPM is not installing the package. The hostname/IP addr

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-03 18:48

    npmjs has a DNS problem according to its incident report: DNS misconfiguration cached in ISP DNS caches.

    To solve your problem, do this:

    1. dig www.npmjs.com @1.1.1.1

      Sample output on Linux

      ; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.npmjs.com @1.1.1.1
      ;; global options: +cmd
      ;; Got answer:
      ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50308
      ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
      
      ;; OPT PSEUDOSECTION:
      ; EDNS: version: 0, flags:; udp: 1452
      ;; QUESTION SECTION:
      ;www.npmjs.com.                 IN      A
      
      ;; ANSWER SECTION:
      www.npmjs.com.          128     IN      CNAME   www.npmjs.com.cdn.cloudflare.net.
      www.npmjs.com.cdn.cloudflare.net. 151 IN A      104.16.109.30
      www.npmjs.com.cdn.cloudflare.net. 151 IN A      104.16.110.30
      
      ;; Query time: 2 msec
      ;; SERVER: 1.1.1.1#53(1.1.1.1)
      ;; WHEN: Sat Sep 01 14:05:56 UTC 2018
      ;; MSG SIZE  rcvd: 120
      
      1. Get resolved IP address: 104.16.109.30 in my case

      2. Add new entry in your /etc/hosts file

        echo "104.16.110.30 www.npmjs.com registry.npmjs.org" >> /etc/hosts

      Do not forget to remove this line at the end of the weekend.

提交回复
热议问题