前情提要
使用npm淘寶鏡像 https://registry.npm.taobao.org
年前創(chuàng)建的vue3項(xiàng)目npm install
完后沒有使用ui寫了點(diǎn)雜七雜八的東西,年后看到一篇文章有點(diǎn)興趣,掏出來準(zhǔn)備試一下,本打算安裝element-plus 寫起來方便點(diǎn)npm install element-plus --save
,結(jié)果就運(yùn)行后就報(bào)錯(cuò)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
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/eslint-config-standard@6.1.0
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: eslint-plugin-vue@7.20.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
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!
看這一堆眼花繚亂的,其實(shí)最有用的就是后幾行,讓我們?cè)谠久钌显黾?--force or --legacy-peer-deps
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
跑起來又又報(bào)錯(cuò)了=.=,好好好,看看報(bào)錯(cuò)信息
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @vue/eslint-config-standard@6.1.0
npm WARN Found: eslint-plugin-vue@8.7.1
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/eslint-config-standard@6.1.0
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: eslint-plugin-vue@7.20.0
npm WARN node_modules/eslint-plugin-vue
npm WARN peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
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: friendly-errors-webpack-plugin@1.7.0
npm WARN Found: webpack@5.89.0
npm WARN node_modules/webpack
npm WARN peer webpack@"^4.0.0 || ^5.0.0" from @soda/friendly-errors-webpack-plugin@1.8.1
npm WARN node_modules/@soda/friendly-errors-webpack-plugin
npm WARN @soda/friendly-errors-webpack-plugin@"^1.8.0" from @vue/cli-service@5.0.8
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 friendly-errors-webpack-plugin@1.7.0
npm WARN node_modules/friendly-errors-webpack-plugin
npm WARN friendly-errors-webpack-plugin@"^1.7.0" from vue-cli-plugin-electron-builder@2.1.1
npm WARN node_modules/vue-cli-plugin-electron-builder
npm WARN
npm WARN Conflicting peer dependency: webpack@4.47.0
npm WARN node_modules/webpack
npm WARN peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from friendly-errors-webpack-plugin@1.7.0
npm WARN node_modules/friendly-errors-webpack-plugin
npm WARN friendly-errors-webpack-plugin@"^1.7.0" from vue-cli-plugin-electron-builder@2.1.1
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不用管,重點(diǎn)看ERR,他說xxx https://registry.npm.taobao.org/element-plus failed(失敗)
這個(gè)地址很眼熟啊,npm taobao這不就是淘寶鏡像嗎,reason:原因 certificate has expired 證書已過期,好家伙,搞了半天淘寶鏡像過期了
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鏡像源
// 先清除緩存
npm cache clean --force
npm config set registry npm鏡像源
開始百度“淘寶鏡像過期”,找到一篇一個(gè)月前熱氣騰騰的救命文章 npm 淘寶鏡像正式到期,趕緊更新!
換源文章來源:http://www.zghlxwxcb.cn/news/detail-835668.html
npm config set registry https://registry.npmmirror.com
重新執(zhí)行,安裝成功??文章來源地址http://www.zghlxwxcb.cn/news/detail-835668.html
npm install element-plus --save --force
到了這里,關(guān)于【報(bào)錯(cuò)】npm ERR! ERESOLVE could not resolve、certificate has expired的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!