报错代码如下:

npm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency treenpm ERR!npm ERR! While resolving: webvue@0.1.0npm ERR! Found: vue@3.2.47npm ERR! node_modules/vuenpm ERR! vue@"^3.2.13" from the root projectnpm ERR!npm ERR! Could not resolve dependency:npm ERR! peer vue@"^2.5.17" from element-ui@2.15.12npm ERR! node_modules/element-uinpm ERR! element-ui@"*" from the root projectnpm ERR!npm ERR! Fix the upstream dependency conflict, or retrynpm ERR! this command with --force, or --legacy-peer-depsnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.npm ERR!npm ERR! See D:\SoftWareLocation\node_js\node_cache\eresolve-report.txt for a full report.npm ERR! A complete log of this run can be found in:npm ERR! D:\SoftWareLocation\node_js\node_cache\_logs\2023-02-09T11_40_48_239Z-debug-0.log

报错原因:由于npm版本太高导致此错误发。npm的版本只要超大于或等于7.x.x,会在某些方面上更加严格,就会导致出现这种情况,低于7.x.x不会出现这种情况

查看npm版本:npm -v

解决方案
1.在指令后面都添加上 –legacy-peer-deps,如下

npm xxx --legacy-peer-deps

2.在指令后面都加上 –force,如下

npm xxx --force

3.降低npm版本(不推荐,谨慎)

npm install npm@6.14.12 -g//降低版本指令,版本自己可选择

因为降低版本后,容易导致npm和node不相容,会出现很大的问题!!!