Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

node.js - nodejs "npm ERR! code SELF_SIGNED_CERT_IN_CHAIN"

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
pm-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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...