cccconch / Travel-Web

一个旅游网站页面开发
0 stars 0 forks source link

vue3使用element-ui遇到的问题 #1

Open cccconch opened 1 month ago

cccconch commented 1 month ago

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: element-ui@2.15.14 npm ERR! Found: vue@3.4.27 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.7.4

npm ERR! node_modules/element-plus npm ERR! element-plus@"^2.7.4" 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.4" from the root project npm ERR! 6 more (@vue/server-renderer, vue-demi, vue-demi, vue-router, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer vue@"^2.5.17" from element-ui@2.15.14 npm ERR! node_modules/element-ui npm ERR! element-ui@"^2.15.14" from the root project npm ERR! npm ERR! Conflicting peer dependency: vue@2.7.16 npm ERR! node_modules/vue npm ERR! peer vue@"^2.5.17" from element-ui@2.15.14 npm ERR! node_modules/element-ui npm ERR! element-ui@"^2.15.14" 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! npm ERR! npm ERR! For a full report see: npm ERR! C:\Users\Administrator\AppData\Local\npm-cache_logs\2024-06-03T13_14_14_957Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache_logs\2024-06-03T13_14_14_957Z-debug-0.log

cccconch commented 1 month ago

问题出现在vue3支持的是element-plus,安装element-ui会报错,我之前安装过一次element-ui,又安装了element-plus所以会报错,需要先卸载依赖项。 在package.json文件里检查安装的依赖项,然后用npm uninstall <依赖项名称>进行卸载。 保险起见也可以删除node-modules文件,然后 npm install重新安装