doubleyong
管理员
管理员
  • 最后登录2025-12-02
  • 发帖数1198
  • 最爱沙发
  • 喜欢达人
  • 原创写手
  • 社区居民
  • 忠实会员
阅读:7515回复:0

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

楼主#
更多 发布于:2017-05-10 16:34
今天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


参考:https://segmentfault.com/a/1190000008658044
           http://www.ithao123.cn/content-101737.html
知识需要管理,知识需要分享
游客


返回顶部

公众号

公众号