npm總是報錯:unable to verify the first certificate


今天npm install總是報錯:unable to verify the first certificate(無法驗證第一證書),查了一下發現

As of February 27, 2014, npm no longer supports its self-signed certificates. 

2014年2月27日,npm不再支持自簽名證書。

因為npm install走的是https協議,需要通過數字證書來保證的

解決方法1:

取消ssl驗證:npm config set strict-ssl false

如果還沒成功,則將npm源更換為國內鏡像:
npm config set registry http://registry.cnpmjs.org/
npm config set registry http://registry.npm.taobao.org/

解決方法2:

升級:npm install npm -g --ca=null
或者 npm config set ca=""

推薦使用方法1


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM