nodejs "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN"

Solution 1:

Disabling strict-ssl mode will remove this error.

npm set strict-ssl false

Since this is turning off SSL security, we should try this as last step if below two steps don't help.

This issue can arise due to incompatibility between SSL certificate file of npm and node registry.

Try

1) telling your current version of npm to use node's ca instead of built in ca

npm config set ca=""

2) OR upgrading your version of npm

npm install npm -g --ca=null

Solution 2:

I had the same problem on windows 10.

open windows powerShell and enter the following command:

npm config set registry http://registry.npmjs.org/

Then you can use:

npm install [your package]

Solution 3:

As metioned by Akshay Vijay Jain above,

npm config set strict-ssl false

TURNING OFF SSL BEFORE INSTALLING THE LATEST VERSION:

TURNING OFF SSL BEFORE INSTALLING THE LATEST VERSION

Then install the latest version

npm install -g npm@latest

INSTALL SUCCESS!!:

INSTALL SUCCESS!!

See the screenshots added for clarity.

Solution 4:

I'm new to npm as well. Besides the commands mentioned in your link I tried the following and it resolved my issues:

  • npm set strict-ssl false
  • disabled McAfee temporarily

Reference: Npm SELF_SIGNED_CERT_IN_CHAIN on Azure