1 问题

在使用npm install或cnpm install的时候,出现以下报错 Error: unable to verify the first certificate

2 原因

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

npm install走的是https协议,需要通过数字证书来保证的

3 解决方法

① 取消ssl验证:npm config set strict-ssl false

如果还没成功,则将npm源更换为国内镜像:

npm config set registry http://registry.npm.taobao.org/

npm config set registry http://registry.cnpmjs.org/

 

② 升级:npm install npm -g --ca=null

或者 npm config set ca=""

推荐使用方法1

 

 

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐