yarn/npm/cnpm报错 Error: unable to verify the first certificate

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

如果是cnpm或者是yarn的话 也需要设置

cnpm config set strict-ssl false
yarn config set strict-ssl false

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

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

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

上一篇:java报错Error attempting to get column ‘XXX’ from result set. Cause: java.sql.怎么解决


下一篇:1676. Lowest Common Ancestor of a Binary Tree IV