npm老是报错:unable to verify the first certificate

今天npm install老是报错:unable to verify the first certificate(没法验证第一证书),查了一下发现npm

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

2014年2月27日,npm再也不支持自签名证书。code

由于npm install走的是https协议,须要经过数字证书来保证的ssl

解决方法1:

取消ssl验证:npm config set strict-ssl falseget

若是还没成功,则将npm源更换为国内镜像:
npm config set registry http://registry.cnpmjs.org/
npm config set registry http://registry.npm.taobao.org/it

解决方法2:

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

推荐使用方法1方法

相关文章
相关标签/搜索