今天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