NPM: trouble in paradise with SELF_SIGNED_CERT_IN_CHAIN

Tonight I was going to give the mean stack a try on my MacBook Pro, when I ran into these kind of problems trying to install some packages with npm.

npm http GET https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm
npm ERR! Error: SELF_SIGNED_CERT_IN_CHAIN
npm ERR!     at SecurePair.<anonymous> (tls.js:1356:32)
npm ERR!     at SecurePair.EventEmitter.emit (events.js:92:17)
npm ERR!     at SecurePair.maybeInitFinished (tls.js:968:10)
npm ERR!     at CleartextStream.read [as _read] (tls.js:462:15)
npm ERR!     at CleartextStream.Readable.read (_stream_readable.js:320:10)
npm ERR!     at EncryptedStream.write [as _write] (tls.js:366:25)
npm ERR!     at doWrite (_stream_writable.js:221:10)
npm ERR!     at writeOrBuffer (_stream_writable.js:211:5)
npm ERR!     at EncryptedStream.Writable.write (_stream_writable.js:180:11)
npm ERR!     at write (_stream_readable.js:583:24)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

When I checked my version with npm --version it told me I had 1.3.11 which had a problem with self signed certificates, so I tried to update my npm installer with npm update npm -g. Too bad! That got me the same error.

So after some Googling and reading other peoples problems I came to the following solution:
sudo npm update npm -g --registry http://registry.npmjs.eu

Apparantly switching to another npm-registry was enough to fix this nasty problem. I now have version 1.4.4 and my packages install great again!

Ronald Harmsen

I'm a software developer. When I'm not developing software I'm training & coaching other developers, speaking on a conference or fiddling with some technical stuff.

Arnhem, The Netherlands

Subscribe to Ronald to the cloud

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!