Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN"

Tags:

node.js

npm

I'm new to nodejs and npm. I'm trying to install log4js and this is the command for the install:

npm install log4js 

I'm running this from Windows Command Line and I after a while of a marker spinning I get the following error:

npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "log4js" npm ERR! node v0.12.0 npm ERR! npm  v2.5.1 npm ERR! code SELF_SIGNED_CERT_IN_CHAIN  npm ERR! self signed certificate in certificate chain npm ERR! npm ERR! If you need help, you may report this error at: npm ERR!     <http://github.com/npm/npm/issues>  npm ERR! Please include the following file with any support request: npm ERR!     C:\srv\npm-debug.log 

I tried doing npm config set ca="" like suggested here: http://blog.npmjs.org/post/78085451721/npms-self-signed-certificate-is-no-more but I'm still getting this error.

How can I solve this and install NPMs ?

like image 690
developer82 Avatar asked Mar 19 '15 09:03

developer82


People also ask

What is Self_signed_cert_in_chain?

The error SELF_SIGNED_CERT_IN_CHAIN means that you have self signed certificate in certificate chain which is basically not trusted by the system.

How do I turn off strict SSL?

Most of these tools have an option to disable strict SSL certificate checking, which let you get around the problem: npm config strict-ssl false. git config --global http. sslverify false.

Why do we need .npmrc file?

npmrc is the configuration file that npm allows to be used globally or user level or project level to optimize your npm environment.

What is Node_extra_ca_certs?

NODE_EXTRA_CA_CERTS. From Node version 7.3. 0, NODE_EXTRA_CA_CERTS environment variable is introduced to pass in a CA certificate file. This allows the “root” CAs to be extended with the extra certificates in file. The file should consist of one or more trusted certificates in PEM format.


1 Answers

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

like image 199
Akshay Vijay Jain Avatar answered Sep 18 '22 19:09

Akshay Vijay Jain