vue3 引入 element-ui 报错 - ERR! ERESOLVE unable to resolve dependency tree
vue3 引入 element-ui 报错。
PS E:\ws06\test-new\20240620-syt\syt-01> npm i element-ui@2.3.5 -S npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: syt-01@0.0.0 npm ERR! Found: vue@3.4.30 npm ERR! node_modules/vue npm ERR! vue@"^3.4.21" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer vue@"^2.5.2" from element-ui@2.3.5 npm ERR! node_modules/element-ui 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! See C:\Users\Administrator.DESKTOP-S92EN3R\AppData\Local\npm-cache\eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator.DESKTOP-S92EN3R\AppData\Local\npm-cache\_logs\2024-06-24T13_55_02_530Z-debug-0.log
问题原因:element-ui不适配vue3,官方已将vue3版本的更新为element-plus
解决:
npm install element-plus --save
引入
import elementPlus from 'element-plus' import 'element-plus/theme-chalk/index.css'; app.use(elementPlus);
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/LxyingINGing/article/details/136021994