![](/img/trans.png)
[英]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.