2016-09-06 74 views
3

我已經安裝版本的NodeJS節點V4.5.0-x64.msi第一證書節點JS錯誤,而安裝故宮安裝快車代碼UNABLE_TO_VERIFY_LEAF_SIGNATURE無法驗證

我安裝使用NPM快遞在Windows中安裝快遞但收到以下錯誤

npm WARN package.json [email protected] No description          
npm WARN package.json [email protected] No repository field. 

npm WARN package.json [email protected] 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 

更新 不僅快遞包裹我不能安裝任何包

回答

6

您可以使用此命令

npm config set strict-ssl false

它只是禁用SSL證書。

但接受無效SSL證書不是最佳做法。

,你可以用這個命令

npm config set strict-ssl true

+0

問題是ssl,標記爲false並且工作正常 –

+0

很高興幫助你:) – abdulbarik

0

相反這可能是繞過您的企業安全策略(不是一個好主意)禁用SSL證書檢查的,我想以後恢復它正確的解決辦法如下:

npm config set cafile="/path/to/cert_authority_file_base64.cer" 

這就解決了「無法驗證第一個證書」錯誤而不禁用SSL證書檢查。

注意:「Chrome cert_authority_file_base64.cer」文件可以從任何HTTPS訪問的網站(組織網絡外部)使用綠色鎖定圖標從當前菜單中導航到「詳細信息」鏈接點擊綠色圖標。您必須將證書保存爲「base64編碼」才能使其工作。