当前位置:   article > 正文

npm install报错:淘宝镜像证书过期_npm install安装为啥一直报镜像过期

npm install安装为啥一直报镜像过期

npm install报错:淘宝镜像证书过期

近期使用npm淘宝镜像新建项目或依赖时出现报错:
npm ERR! request to https://registry.npm.taobao.org/xxx failed, reason: certificate has expired

错误原因:

早在 2021 年,淘宝就发文称,npm 淘宝镜像已经从 http://registry.npm.taobao.org 切换到了 http://registry.npmmirror.com。旧域名也将于 2022 年 5 月 31 日停止服务(直到 HTTPS 证书到期才真正不能用了)

2024年1 月 22 日,淘宝原镜像域名(http://registry.npm.taobao.org)的 HTTPS 证书正式到期,导致旧的 npm 淘宝镜像在使用时出错了。


解决方案:

  1. 查看当前的npm镜像设置
npm config get registry
  • 1
  1. 切换新源
npm config set registry https://registry.npmmirror.com
  • 1
  1. 查看新源是否设置成功
npm config get registry
  • 1
  1. 可以正常安装需要的工具了

国内镜像还有如下,根据自己的需要使用:
腾讯:http://mirrors.cloud.tencent.com/npm/
华为:https://mirrors.huaweicloud.com/repository/npm/
中科大镜像:https://registry.npmjs.org/

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Guff_9hys/article/detail/860588
推荐阅读
相关标签
  

闽ICP备14008679号