npm i vuex下载报错 解决方法

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: vue-manage@0.1.0
npm ERR! Found: vue@2.7.10
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 vuex@4.0.2
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\77\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\77\AppData\Local\npm-cache\_logs\2022-09-20T13_05_10_167Z-debug-0.log

 原因是因为npm版本不匹配

使用下面这条命令执行即可

npm i vuex --legacy-peer-deps

added 2 packages, and audited 895 packages in 2s

100 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


版权声明:本文为m0_70208154原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。