First look at the error when installing vuex version conflict in vue
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR! vue@"^2.6.14" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^3.0.2" from [email protected]
npm ERR! node_modules/vuex
npm ERR! vuex@"*" 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! See C:\Users\CRain\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\CRain\AppData\Local\npm-cache\_logs\2022-07-30T08_16_52_001Z-debug-0.log
npm ERR! vue@"^2.6.14" from the root project
Here you can see that the currently installed vue version is vue2, and you can also view the currently installed version of vue and other things in the package.json file under the vue root directory
The version of vuex3 needs to be installed in vue2
npm i vuex@3 --save
The version of vuex4 needs to be installed in vue3
npm i vuex@4 --save