先看看在vue中安装vuex版本冲突时的报错
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
这里可以看到当前安装的vue版本为vue2,也可以在vue根目录下面的package.json文件中查看当前安装的vue以及其他一些东西的版本
在vue2中需要安装vuex3的版本
npm i vuex@3 --save
在vue3中需要安装vuex4的版本
npm i vuex@4 --save