NPM Self Signed Cert Issues

A while ago I ran into the following error when trying to install a typings definition file for an old project I was working on at the time.

ERR! message Unable to connect to ""

The root cause of the issue was the following:

typings ERR! caused by self signed certificate in certificate chain

This was cased by a man-in-the-middle certificate authority (CA) used on our domain as part of our DLP and security practices. Needless to say, nothing on the CA side is bound to change any time soon - I had to find a better solution to the problem, and in fact, I found 2 solutions.

The first one I found was pretty simple, and just involves changing the npm repository url from https to http - this can be done with the following command.

npm config set registry

Note: This only fixes issues when working with npm packages - i.e. it didn't resolve my initial issue with typings

To work around the typings issue I found that we can set the ca used by npm to null with the following command:

npm install npm -g --ca=null

That resolved my issue and I was able to carry on with my development :).

comments powered by Disqus