需要安装一个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/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
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/eslint-config-standard@6.1.0
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: eslint-plugin-vue@7.20.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
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
完美解决
网友评论