1、问题概述?

执行npm install命令的时候报错如下:

tangxiaochun@tangxiaochundeMacBook-Pro stf % npm install                       
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: stf@3.4.1
npm ERR! Found: webpack@1.15.0
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"^1.12.11" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from webpack-dev-server@3.1.11
npm ERR! node_modules/webpack-dev-server
npm ERR!   dev webpack-dev-server@"^3.1.11" 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! /Users/tangxiaochun/.npm/_logs/2024-02-28T05_19_31_048Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/tangxiaochun/.npm/_logs/2024-02-28T05_19_31_048Z-debug-0.log

2、解决办法

降低或者提高npm的版本信息,一般都是需要降低的。

【修改npm版本信息命令】

【修改后查询mpm的版本信息】

npm ERR! code ERESOLVE-LMLPHP

【再次执行npm install命令】

02-29 06:55