npm error request to https://registry.npm.taobao.org/cnpm failed, reason: certificate has expired

是因为:npm错误请求https://registry.npm.taobao.org/cnpm失败,原因:证书已过期,

2024年1月22日,淘宝NPM镜像站的域名 registry.npm.taobao.org 的SSL证书过期

解决方案

1、清除npm缓存

npm cache clean --force

如果报一下错误,是因为npm版本过高的问题

可以使用,新版清除npm缓存的命令

npm cache verify

2、切换到新的npm镜像站

npm config get registry

执行返回的是 https://registry.npmjs.org/说明切换成功了

3、使用新镜像安装cnpm

npm install -g cnpm --registry=https://registry.npmmirror.com

耐心等待一下

执行完成结果

后续可以使用cnpm安装需要的镜像

4、验证是否成功

cnpm -v

Logo

一站式 AI 云服务平台

更多推荐