vue3 element-plus @element-plus/icons-vue安装运行报错Could not resolve “@vue/shared“

本文介绍了Element Plus图标组件的正确安装方法。针对@element-plus/icons-vue安装出现的问题,建议安装1.x版本,并提供相关依赖版本参考。

element-plus的icon图标一改element-ui版本的直接引用,变成了需要额外安装@element-plus/icons-vue。
在这里插入图片描述
按照官网的命令,直接安装最新版,安装时没问题,运行之后报错Could not resolve “@vue/shared”,安装了@vue/shared之后还有错误,怒删之。经过测试,不要安装最新版的@element-plus/icons-vue,安装1.x版本的,没问题。

pnpm install @element-plus/icons-vue@1.x

其他依赖版本如下
“vue”: “^3.2.38”,
“element-plus”: “^2.2.25”,

npm install npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @vue/composition-api@1.7.2 npm ERR! Found: vue@3.5.24 npm ERR! node_modules/vue npm ERR! vue@"^3.5.13" from the root project npm ERR! peer vue@"^3.2.0" from @element-plus/icons-vue@2.3.2 npm ERR! node_modules/@element-plus/icons-vue npm ERR! @element-plus/icons-vue@"^2.3.1" from the root project npm ERR! @element-plus/icons-vue@"^2.3.2" from element-plus@2.11.7 npm ERR! node_modules/element-plus npm ERR! element-plus@"^2.9.7" from the root project npm ERR! 12 more (@tinymce/tinymce-vue, @vitejs/plugin-vue, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer vue@">= 2.5 < 2.7" from @vue/composition-api@1.7.2 npm ERR! node_modules/@vue/composition-api npm ERR! @vue/composition-api@"^1.7.2" from the root project npm ERR! peerOptional @vue/composition-api@"^1.7.1" from @vue-office/docx@1.6.3 npm ERR! node_modules/@vue-office/docx npm ERR! @vue-office/docx@"^1.6.3" from the root project npm ERR! 4 more (vue-demi, @vue-office/excel, @vue-office/pdf, @vue-office/pptx) npm ERR! npm ERR! Conflicting peer dependency: vue@2.6.14 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! @vue/composition-api@"^1.7.2" from the root project npm ERR! peerOptional @vue/composition-api@"^1.7.1" from @vue-office/docx@1.6.3 npm ERR! node_modules/@vue-office/docx npm ERR! @vue-office/docx@"^1.6.3" from the root project npm ERR! 4 more (vue-demi, @vue-office/excel, @vue-office/pdf, @vue-office/pptx) 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! npm ERR! npm ERR! For a full report see: npm ERR! C:\Program Files\nodejs\node_cache\_logs\2025-11-13T06_20_14_241Z-eresolve-report.txt npm ERR! A complete log of this run can be found in: C:\Program Files\nodejs\node_cache\_logs\2025-11-13T06_20_14_241Z-debug-0.log
11-14
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值