今天npm install總是報錯:unable to verify the first certificate(無法驗證第一證書),查了一下發現:
2014年2月27日,npm不再支持自簽名證書;
因為npm install走的是https協議,需要通過數字證書來保證的;
解決方法1:
取消ssl驗證:npm config set strict-ssl false;
如果還沒成功,則將npm源更換為國內鏡像:
npm config set registryhttp://registry.cnpmjs.org/;
npm config set registryhttp://registry.npm.taobao.org/;
解決方法2:
升級:npm install npm -g --ca=null或者 npm config set ca="";
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?轉載請注明來源!