网站建设规划书感受,模板网站建设代理商,网站后台管理进入,昌平网站开发公司电话目录 前情提要#xff1a; 背景#xff1a; 镜像源更新#xff1a; 清楚缓存#xff1a; 直接切换镜像源#xff1a; 补充#xff1a; 错误解释#xff1a; 解决方法#xff1a; 前情提要#xff1a; 2024 /1 /22 #xff0c;registry.npm.taobao.org淘宝镜像源的SSL… 目录 前情提要 背景 镜像源更新 清楚缓存 直接切换镜像源 补充 错误解释 解决方法 前情提要 2024 /1 /22 registry.npm.taobao.org淘宝镜像源的SSL证书过期了这就使得我们在通过该镜像源安装一些软件包的时候会报错。 所以我们只需要更换镜像源为新的registry.npmmirror.com 背景 本文就是因为我在更新一个项目的依赖时出现报错: ERR_PNPM_META_FETCH_FAIL GET https://registry.npm.taobao.org/pnpm: request to https://registry.npm.taobao.org/pnpm failed, reason: certificate has expired 先解释一下这个报错 无法从淘宝的npm镜像源registry.npm.taobao.org获取 pnpm 包的元数据因为该源的SSL证书已经过期 所以需要更换镜像源为新的registry.npmmirror.com 镜像源更新 我用的是pnpm所以优先讲解pnpm的解决方法 清楚缓存 npm cache clean --force pnpm store prune npm不需要第二步 直接切换镜像源 # npm 官方源
pnpm config set registry https://registry.npmjs.org# 新taobao 源
pnpm config set registry https://registry.npmmirror.com 查看 C盘/user /你的用户名user/xxx/.npmrc 文件目录下的 .npmrc 中的源地址有没有变成新的 如果更新好了就不用管了如果还是原来的可以手动换成新的源registry.npmmirror.com 补充 此时如果你直接去更新项目中的某个依赖而不是所有依赖例如只想更新elementplus会出现pnpm install element-pluslatest ERR_PNPM_REGISTRIES_MISMATCH This modules directory was created using the following registries configuration: {default:https://registry.npm.taobao.org/}. The current configuration is {default:https://registry.npmmirror.com/}. To recreate the modules directory using the new settings, run pnpm install. 错误解释 ERR_PNPM_REGISTRIES_MISMATCH 表示你正在尝试使用与最初创建 node_modules 目录时不同的源来安装依赖项。在这个案例中node_modules 目录是用淘宝的 npm 镜像源 https://registry.npm.taobao.org/ 创建的但是你当前的配置是另一个源 https://registry.npmmirror.com/ 解决方法 按照错误消息中的建议使用当前配置的源来重新创建 node_modules 目录 删除现有的 node_modules 和 lock 文件 rm -rf node_modules pnpm-lock.yaml 重新安装依赖项 pnpm install 至此问题解决