安装vuex-persistedstate的使用报错

需要安装一个vuex的插件vuex-persistedstate来支持vuex的状态持久化。

然后就出现了报错!

npm install --save vuex-persistedstate
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/[email protected]
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/[email protected]
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^6.1.0" 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\65103\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\65103\AppData\Local\npm-cache\_logs\2022-09-26T17_00_04_915Z-debug-0.log

原因是eslint版本过高 ,使用同级安装命令npm install --legacy-peer-deps就能安装好!

听说还有一种方法也能解决这个问题,-f--force:将强制 npm 获取远程资源,即使磁盘上存在本地副本也是如此。但是还是建议使用第一种同级安装命令比较好。
我是用的是第二种 npm install --save vuex-persistedstate -f 完美解决

你可能感兴趣的:(安装vuex-persistedstate的使用报错)