[英]Installing custom SSL certificate in Node (UNABLE_TO_VERIFY_LEAF_SIGNATURE)
[英]node js Error while installing npm install express code UNABLE_TO_VERIFY_LEAF_SIGNATURE unable to verify the first certificate
我安装了nodejs版本node-v4.5.0-x64.msi
我在Windows中使用npm install express安装express ,但是出现以下错误
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
更新不仅快递包我无法安装任何包
您可以使用此命令
npm config set strict-ssl false
它只是禁用了SSL证书。
但接受无效的SSL证书并不是最佳做法。
您可以稍后使用此命令恢复它
npm config set strict-ssl true
我认为正确的解决方案如下所示,而不是禁用可能绕过公司安全策略的SSL证书检查(不是一个好主意)。
npm config set cafile="/path/to/cert_authority_file_base64.cer"
这解决了“无法验证第一个证书”错误而不禁用SSL证书检查。
注意:可以使用绿色锁定图标从任何HTTPS访问的网站(组织网络外部)在Chrome中获取“cert_authority_file_base64.cer”文件,并从单击绿色时出现的菜单导航到“详细信息”链接图标。 您必须将证书保存为“base64 encoded”才能生效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.