Unable to install anything with NPM (or apm)

registry
priority:critical
triaged

(Malte Gejr) #1

What I Wanted to Do

I was trying to install a package in atom, but it failed, and so does NPM

What Happened Instead

It fail with a hostname/IP error

Reproduction Steps

I ran two commands both failed.
apm install linter-jshint
and
npm install node-sass

Details

I’ve tried via apm in the terminal and inside atom. Heres the terminal output:

npm ERR! Linux 4.15.0-33-generic
npm ERR! argv "/snap/atom/192/usr/share/atom/resources/app/apm/bin/node" "/snap/atom/192/usr/share/atom/resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/home/apollo/.atom/.apm/.apmrc" "--userconfig" "/home/apollo/.atom/.apmrc" "install" "/tmp/d-11881-14860-1pydqer.rrx1lwhfr/package.tgz" "--runtime=electron" "--target=2.0.5" "--arch=x64" "--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!     /tmp/apm-install-dir-11881-14860-1m7vveu.hg0seb3xr/npm-debug.log

There is no npm-debug.log located in /tmp/apm-install-dir-11881-14860-1m7vveu.hg0seb3xr/npm-debug.log The folder doesn’t even exist.

I then tried to install a package trough npm
npm install node-sass
And it made a debug.log which is attached
npm-debug.log (6.2 KB)

Platform Info

System specs:
OS: Ubuntu 18.04.1 LTS x86_64
Kernel: 4.15.0-33-generic
node version: v8.10.0
NPM: version: 3.5.2

$ npm --versions
{ npm: '3.5.2',
  ares: '1.14.0',
  cldr: '32.0.1',
  http_parser: '2.7.1',
  icu: '60.2',
  modules: '57',
  nghttp2: '1.30.0',
  node: '8.10.0',
  openssl: '1.1.0g',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.18.0',
  v8: '6.2.414.50',
  zlib: '1.2.11' }


$ node -p process.platform
linux

(Eric Crooks) #2

Ran into the same issue a few minutes ago when trying to install babel-core and babel-cli. Just to check if it was isolated to babel, I tried installing other packages (express, bower, and grunt) and ran into the same issue. This is the message I received when trying to install the packages:

npm ERR! code ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! errno ERR_TLS_CERT_ALTNAME_INVALID
npm ERR! request to https://registry.npmjs.org/{package_name} 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

(Malte Gejr) #3

There is an SSL error on the website https://registry.npmjs.org/ I’m pretty sure that’s what’s causing these errors.


(Eric Crooks) #4

Apparently there was a DNS misconfiguration issue: https://status.npmjs.org/incidents/v22ffls5cd6h

I’ve solved my issue by resolving npmjs.org and npmjs.com to 104.16.110.30 and in my /etc/hosts file. Got the instructions from the above link.

This is what is in my /etc/hosts file right now (will be removing this entry once the DNS cache clears and npmjs domains are good to go again, which should be at the end of the weekend-ish according to the status page):

104.16.110.30 npmjs.org npmjs.com


registry.npmjs.org ssl certificate error
(Lewis Crichton) #5

I’ll give it a shot in a minute on my WSL install.


(Shift001) #6

I actually needed to add 104.16.110.30 npmjs.org npmjs.com registry.npmjs.org and then it worked, remember to remove the entry later!


Search for word "security" on npm website returns error "Hostname/IP doesn't match certificate's altnames"
(zbigg) #7

I’ve digged ‘npmjs.com’ by mistake, whereas ‘www.npmjs.com’ yields same addresses as yours.

This one works for me:

104.16.110.30 registry.npmjs.org npmjs.org registry.npmjs.com npmjs.com

BTW, half hour ago they responded with cert ‘*.npmjs.com’ which rendered this alias unusable too.

Nevertheless thanks,


(Eric Crooks) #8

Yeah I was doing something wrong the first few tries until I copy-pasted that dig line from the status page. Np btw!


(Rhys Arkins) #9

This error has broken builds on Netlify for me too - no way for me to hardcode their hosts and hence no way to deploy sites.


(Eric Crooks) #10

Looks like the https://registry.npmjs.org/ is working again


(Zac Collier) #11

the solution suggested by @crookse and @zbigg worked for me as well

added to my /etc/hosts file:

104.16.110.30 registry.npmjs.org npmjs.org registry.npmjs.com npmjs.com

registry.npmjs.org ssl certificate error
(system) #12

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.