vue的脚手架中安装vant包报错:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: wangyiyun-app@0.1.0
npm ERR! Found: vue@2.7.8
npm ERR! node_modules/vue
npm ERR! vue@"^2.6.14" from the root project
npm ERR!
npm ERR! peer vue@"^3.0.0" from vant@3.5.4
npm ERR! node_modules/vant
npm ERR! vant@"*" 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 D:\Program Files\nodejs\node_cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Program Files\nodejs\node_cache\_logs\2022-08-08T17_12_53_707Z-debug-0.log
问题的产生的原因
nodejs的环境和vant包不兼容,安装vue的环境是
vue@“^2.6.14” from the root project
安装vant包的环境
RR! peer vue@“^3.0.0” from vant@3.5.1
npm ERR! Fix the upstream dependency conflict, or retry。
【翻译】修复上流环境依赖冲突,或者重试
npm ERR! this command with --force, or --legacy-peer-deps。
【翻译】解决方法,命令后面添加–force, or --legacy-peer-deps