执行npm install element-ui -S报错
npm install element-ui -S
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! While resolving: my-project0817@0.1.0
npm ERR! Found: vue@3.3.4
npm ERR! node_modules/vue
npm ERR! vue@"^3.2.13" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^2.5.17" from element-ui@2.15.13
npm ERR! node_modules/element-ui
npm ERR! element-ui@"*" 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\LENOVO\AppData\Local\npm-cache\_logs\2023-08-17T12_24_41_623Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: C:\Users\LENOVO\AppData\Local\npm-cache\_logs\2023-08-17T12_24_41_623Z-debug-0.log
解决方法
npm install element-plus --save
原因
参考的网站错误了,
npm install element-ui -S
对应的是https://element.eleme.cn/#/zh-CN/component/installation
npm install element-plus --save
对应的是 https://element-plus.gitee.io/zh-CN/
element-ui 的版本是这样匹配的vue@“^2.5.17” from element-ui@2.15.13
element-plus 匹配的版本是vue@“^5.08”