npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Unable to install anything with NPM (or apm)

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
npm install node-sass


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: is not in the cert's altnames:,"
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <>
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

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! request to{package_name} failed, reason: Hostname/IP does not match certificate's altnames: Host: is not in the cert's altnames:,

There is an SSL error on the website I’m pretty sure that’s what’s causing these errors.

Apparently there was a DNS misconfiguration issue:

I’ve solved my issue by resolving and to 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):

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

I actually needed to add and then it worked, remember to remove the entry later!

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

This one works for me:

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

Nevertheless thanks,

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

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.

Looks like the is working again

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

added to my /etc/hosts file: