【报错】npm ERR! ERESOLVE could not resolve、certificate has expired

前情提要

使用npm淘宝镜像 https://registry.npm.taobao.org

年前创建的vue3项目npm install 完后没有使用ui写了点杂七杂八的东西,年后看到一篇文章有点兴趣,掏出来准备试一下,本打算安装element-plus 写起来方便点npm install element-plus --save ,结果就运行后就报错

shell 复制代码
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @vue/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/[email protected]
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/[email protected]
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 

看这一堆眼花缭乱的,其实最有用的就是后几行,让我们在原本命令上增加 --force or --legacy-peer-deps

shell 复制代码
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

也就是npm install element-plus --save --force 跑起来又又报错了=.=,好好好,看看报错信息

shell 复制代码
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @vue/[email protected]
npm WARN Found: [email protected]
npm WARN node_modules/eslint-plugin-vue
npm WARN   dev eslint-plugin-vue@"^8.0.3" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-vue@"^7.0.0" from @vue/[email protected]
npm WARN node_modules/@vue/eslint-config-standard
npm WARN   dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm WARN 
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/eslint-plugin-vue
npm WARN   peer eslint-plugin-vue@"^7.0.0" from @vue/[email protected]
npm WARN   node_modules/@vue/eslint-config-standard
npm WARN     dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/webpack
npm WARN   peer webpack@"^4.0.0 || ^5.0.0" from @soda/[email protected]
npm WARN   node_modules/@soda/friendly-errors-webpack-plugin
npm WARN     @soda/friendly-errors-webpack-plugin@"^1.8.0" from @vue/[email protected]
npm WARN     node_modules/@vue/cli-service
npm WARN   20 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from [email protected]
npm WARN node_modules/friendly-errors-webpack-plugin
npm WARN   friendly-errors-webpack-plugin@"^1.7.0" from [email protected]
npm WARN   node_modules/vue-cli-plugin-electron-builder
npm WARN 
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/webpack
npm WARN   peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from [email protected]
npm WARN   node_modules/friendly-errors-webpack-plugin
npm WARN     friendly-errors-webpack-plugin@"^1.7.0" from [email protected]
npm WARN     node_modules/vue-cli-plugin-electron-builder
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/element-plus failed, reason: certificate has expired

上面都是WARN不用管,重点看ERR,他说xxx https://registry.npm.taobao.org/element-plus failed(失败)

这个地址很眼熟啊,npm taobao这不就是淘宝镜像吗,reason:原因 certificate has expired 证书已过期,好家伙,搞了半天淘宝镜像过期了

shell 复制代码
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/element-plus failed, reason: certificate has expired

解决

找到根源,就好解决了, 切换npm镜像源

shell 复制代码
// 先清除缓存
npm cache clean --force
npm config set registry npm镜像源

开始百度"淘宝镜像过期",找到一篇一个月前热气腾腾的救命文章 npm 淘宝镜像正式到期,赶紧更新!

换源

shell 复制代码
npm config set registry https://registry.npmmirror.com

重新执行,安装成功🏅

shell 复制代码
npm install element-plus --save --force      
相关推荐
爱摄影的程序猿5 分钟前
Python Web 框架 django-vue3-admin快速入门 django后台管理
前端·python·django
洁洁!19 分钟前
数据采集助力AI大模型训练
前端·人工智能·easyui
MiyueFE28 分钟前
bpmn-js 源码篇9:Moddle - 对象格式的标准化定义库
前端·javascript
excel34 分钟前
webpack 核心编译器 七 节
前端
一只月月鸟呀41 分钟前
HTML中数字和字母不换行显示
前端·html·css3
天下代码客1 小时前
【八股】介绍Promise(ES6引入)
前端·ecmascript·es6
lb29171 小时前
CSS 3D变换,transform:translateZ()
前端·css·3d
啊阿狸不会拉杆1 小时前
第二十二章:Python-NLTK库:自然语言处理
前端·python·自然语言处理
萧寂1731 小时前
html实现手势密码
前端·css·html
excel1 小时前
webpack 核心编译器 八 节
前端