Solve npm ERR! code ERESOLVE -npm ERR! ERESOLVE could not resolve

When using a vue source code to develop a project, npm install reported an error

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/webpack
npm ERR! webpack@"^4.0.0" from @vue/[email protected]
npm ERR! node_modules/@vue/cli-plugin-babel
npm ERR! dev @vue/cli-plugin-babel@"4.4.4" from the root project
npm ERR! webpack@"^4.0.0" from @vue/[email protected]
npm ERR! node_modules/@vue/cli-service
npm ERR! dev @vue/cli-service@"4.4.4" from the root project
npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/[email protected]
npm ERR! node_modules/@vue/cli-plugin-babel
npm ERR! dev @vue/cli-plugin-babel@"4.4.4" from the root project
npm ERR! 2 more (@vue/cli-plugin-eslint, @vue/cli-plugin-unit-jest)
npm ERR! 2 more (@vue/cli-plugin-eslint, html-webpack-plugin)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev less-loader@"^11.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^5.0.0" from [email protected]
npm ERR! node_modules/less-loader
npm ERR! dev less-loader@"^11.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! See C:\Users\63089\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\63089\AppData\Local\npm-cache_logs\2023-08-04T04_52_18_223Z-debug-0.log

The reason for the error is

  1. Item used [email protected].
  2. The project requires this version to be specified [email protected]in @vue/[email protected]and .@vue/[email protected]
  3. less-loaderDependencies conflicted. The project requires less-loader@"^11.1.0", but in conflict with this [email protected], it requires less-loader@"^11.1.3".

Reduce the version of less-loader, solved

"less-loader": "^7.x.x",

Guess you like

Origin blog.csdn.net/taoshihan/article/details/132115122