2025-06-29
npm
00

目录

npm提示报错
原因
解决方案

npm提示报错

npm报错:request to https://registry.npm.taobao.org/tdesign-miniprogram failed, reason: certificate has expired

Snipaste_2025-06-29_22-13-48.png

原因

npm淘宝镜像已经从registry.npm.taobao.org切换到了registry.npmmirror.comregistry.npm.taobao.org也将于2022年5月31日停止服务,所以npm报证书过期。

解决方案

老项目记得先删掉package-lock.json

  1. 查看当前的npm镜像配置
bash
npm config list

image.png

  1. 清除缓存
bash
npm cache clean --force
  1. 修改镜像
bash
npm config set registry https://registry.npmjs.org/ 或 npm config delete registry

国内推荐使用淘宝镜像

bash
npm config set registry https://registry.npmmirror.com
  1. 查看镜像配置
bash
npm config list

Snipaste_2025-06-29_22-29-07.png

查看registry已经被更改为新设置的npm镜像地址,之后即可正常使用npm。

本文作者:哈希喵

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!