Solution to solve npm installation dependency conflict

npm WARN cli npm v9.6.4 does not support Node.js v14.16.0. This version of npm supports the following node versions: `^14.17.0 || ^16.13.0 || >=18.0.0`. You can find the latest version at https://nodejs.org/.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: less-loader@4.1.0
npm ERR! Found: less@4.1.2
npm ERR! node_modules/less
npm ERR!   less@"^4.1.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer less@"^2.3.1 || ^3.0.0" from less-loader@4.1.0
npm ERR! node_modules/less-loader
npm ERR!   less-loader@"^4.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: less@3.13.1
npm ERR! node_modules/less
npm ERR!   peer less@"^2.3.1 || ^3.0.0" from less-loader@4.1.0
npm ERR!   node_modules/less-loader
npm ERR!     less-loader@"^4.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!
npm ERR! For a full report see:
npm ERR! C:\Users\Administrator\AppData\Local\npm-cache\_logs\2023-04-14T10_08_49_684Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\Administrator\AppData\Local\npm-cache\_logs\2023-04-14T10_08_49_684Z-debug-0.log

An error was reported during the installation, which can be added later and –legacy-peer-deps
insert image description here
the installation was successful.

The --legacy-peer-deps flag was introduced in v7 to bypass the automatic installation of peerDependency; it tells NPM to ignore the same modules but different versions of the modules introduced in the project and continue to install, ensuring that each imported Dependencies coexist with different versions of modules used by themselves.

Guess you like

Origin blog.csdn.net/weixin_44244924/article/details/130159621