首页 前端知识 npm install pinia-plugin-persist npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve

npm install pinia-plugin-persist npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve

2024-06-07 23:06:11 前端知识 前端哥 990 993 我要收藏

报错信息:
npm install pinia-plugin-persist
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: material-pro@0.0.0
npm ERR! Found: vue@3.4.19
npm ERR! node_modules/vue
npm ERR! peer vue@“^3.2.0” from @element-plus/icons-vue@2.3.1
npm ERR! node_modules/@element-plus/icons-vue
npm ERR! @element-plus/icons-vue@“^2.3.1” from element-plus@2.5.6
npm ERR! node_modules/element-plus
npm ERR! element-plus@“^2.5.6” from the root project
npm ERR! @element-plus/icons-vue@“^2.3.1” from the root project
npm ERR! peer vue@“^3.2.25” from @vitejs/plugin-vue@5.0.4
npm ERR! node_modules/@vitejs/plugin-vue
npm ERR! dev @vitejs/plugin-vue@“^5.0.3” from the root project
npm ERR! 16 more (@vitejs/plugin-vue-jsx, @vue/server-renderer, …)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! pinia-plugin-persist@“" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: vue@3.4.21
npm ERR! node_modules/vue
npm ERR! peer vue@“>= 2.5 < 2.7” from @vue/composition-api@1.7.2
npm ERR! node_modules/@vue/composition-api
npm ERR! peerOptional @vue/composition-api@“^1.0.0” from pinia-plugin-persist@1.0.0
npm ERR! node_modules/pinia-plugin-persist
npm ERR! pinia-plugin-persist@"
” from the root project
npm ERR! peerOptional @vue/composition-api@“^1.4.0” from pinia@2.1.7
npm ERR! node_modules/pinia
npm ERR! pinia@“^2.1.7” from the root project
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See D:\installation_D\node-v16.13.1\node_cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! D:\installation_D\node-v16.13.1\node_cache_logs\2024-03-01T15_46_08_322Z-debug.log

翻译:
npm安装pinia插件持久化
npm ERR!代码ERESOLVE
npm ERR!ERESOLVE无法解析
npm ERR!
npm ERR!解决时:material-pro@0.0.0
npm ERR!建立vue@3.4.19
npm ERR!node_modules/vue
npm ERR!来自@element plus的peer vue@“^3.2.0”/icons-vue@2.3.1
npm ERR!node_modules/@element-plus/icons-vue
npm ERR@元素加/图标vue@“^2.3.1”来自element-plus@2.5.6
npm ERR!node_modules/element-plus
npm ERR!元素加上根项目的@“^2.5.6”
npm ERR@element plus/icons vue@“^2.3.1”来自根项目
npm ERR!来自@vitejs的peer vue@“^3.2.25”/plugin-vue@5.0.4
npm ERR!node_modules/@vitejs/plugin-vue
npm ERR!dev@vitejs/plugin-vue@“^5.0.3”来自根项目
npm ERR!还有16个(@vitejs/plugin-vue-jsx,@vue/server renderer,…)
npm ERR!
npm ERR!无法解析依赖项:
npm ERR!来自根项目的pinia插件persistent@“
npm ERR!
npm ERR!冲突的对等依赖关系:vue@3.4.21
npm ERR!node_modules/vue
npm ERR!peer vue@“>=2.5<2.7”来自@vue/composition-api@1.7.2
npm ERR!node_modules/@vue/composition api
npm ERR!peerOptional@vue/composition-api@“^1.0.0”来自pinia-plugin-persist@1.0.0
npm ERR!node_modules/pinia插件持久化
npm ERR!来自根项目的pinia插件persistent@“

npm ERR!peerOptional@vue/composition api@“^1.4.0”来自pinia@2.1.7
npm ERR!node_modules/pinia
npm ERR!pinia@“^2.1.7”来自根项目
npm ERR!该命令带有–force或–legacy peer deps
npm ERR!以接受不正确的(并且可能被破坏的)依赖性解决方案。
npm ERR!
npm ERR!有关完整报告,请参阅D:\installation_D\node-v16.13.1\node_cache\eresolve-report.txt。
npm ERR!此运行的完整日志可在以下位置找到:
npm ERR!D: \installation_D\node-v16.13.1\node_cache\logs\2024-03-01T15_46_08_322Z-debug.log

分析:
“冲突的对等依赖关系:vue@3.4.21”
应该是出现了版本冲突的问题

解决方法:
1.降低vue版本:npm install vue@3.2.31 --force
2.删除node-modules目录和package-lock.json
3.npm install重新匹配依赖
(如果不删除node-modules目录和package-lock.json重新npm install重新匹配依赖的话,可能会打不开项目报错:

[ERROR] No matching export in "node_modules/pinia/node_modules/vue-demi/lib/index.mjs" for import "hasInjectionContext"

node_modules/pinia/dist/pinia.mjs:6:9:
  6 │ import { hasInjectionContext, inject, toRaw, watch, unref, markRaw, effectScope, ref, isVue2, isRef, isReactive, set, getCurrentScope, onScopeDispose, getCurrentIn...)

参考文章:
pinia、pinia-plugin-persistedstate包安装失败解决办法
npm安装依赖时出现Peer Dependencies冲突报错
解决安装依赖时报错:npm ERR! code ERESOLVE

转载请注明出处或者链接地址:https://www.qianduange.cn//article/11368.html
标签
评论
发布的文章

echarts 鼠标划过显示信息

2024-06-14 23:06:40

echarts@5 动画失效

2024-06-14 23:06:39

vue3 聊天机器人 聊天界面

2024-06-14 23:06:06

Vue - Vue3 集成编辑器功能

2024-06-14 23:06:54

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!