【Vue报错】npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR!

The error code is as follows:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: webvue@0.1.0
npm ERR! Found: vue@3.2.47
npm ERR! node_modules/vue
npm ERR!   vue@"^3.2.13" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^2.5.17" from element-ui@2.15.12
npm ERR! node_modules/element-ui
npm ERR!   element-ui@"*" 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:\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

Reason for error: This error was sent because the npm version was too high. As long as the version of npm is greater than or equal to 7.xx, it will be stricter in some aspects, which will lead to this situation, and this situation will not occur if it is lower than 7.xx

查看npm版本:npm -v

Solution
1. Add --legacy-peer-deps after the command, as follows

npm xxx --legacy-peer-deps

2. Add --force after the command, as follows

npm xxx --force

3. Lower the npm version (not recommended, be cautious)

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

Because after lowering the version, it is easy to cause incompatibility between npm and node, and there will be big problems! ! !

Guess you like

Origin blog.csdn.net/m0_46533551/article/details/128953495