npm install certificate has expired 证书过期的解决办法

npm install 时 certificate has expired 错误的解决办法

报错:npm ERR! request to https://registry.npm.taobao.org/events failed, reason: certificate has expired

 
shell
复制代码
npm install 
npm ERR! code CERT_HAS_EXPIRED  
npm ERR! errno CERT_HAS_EXPIRED  
npm ERR! request to https://registry.npm.taobao.org/events failed, reason: certificate has expired  
  
npm ERR! A complete log of this run can be found in:  
npm ERR! /.npm/_logs/2024-01-24T08_52_27_547Z-debug.log  
ERROR: Job failed: exit status 1

原因:证书过期

简单粗暴的解决办法:
关闭 npm ssl 严格证书检查

 
shell
复制代码
npm set strict-ssl false

或切换到官方源:
npm config set registry https://registry.npmjs.org/
 
 淘宝镜像源

npm config set registry https://registry.npmmirror.com

 
posted @ 2024-02-04 18:07  GaoYanbing  阅读(16255)  评论(1编辑  收藏  举报