Prakash Joshi Prakash Joshi - 3 months ago 158
Node.js Question

node js Error while installing npm install express code UNABLE_TO_VERIFY_LEAF_SIGNATURE unable to verify the first certificate

I have installed nodejs version node-v4.5.0-x64.msi

I am installing express using npm install express in windows but getting following error

npm WARN package.json demo2@1.0.0 No description
npm WARN package.json demo2@1.0.0 No repository field.

npm WARN package.json demo2@1.0.0 No README data
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" "express"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE

npm ERR! unable to verify the first certificate
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR! D:\user\Node\demo2\npm-debug.log


Update
not only express package I was not able to install any package

Answer

You can use this command

npm config set strict-ssl false

It just disabled SSL certificates.

But it's not a best practice to accept invalid SSL certificate.

you can revert it later with this command

npm config set strict-ssl true