共计 569 个字符,预计需要花费 2 分钟才能阅读完成。
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
正文完