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.txtnpm 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版本信息命令】
npm install -g npm@6.14.18
【修改后查詢mpm的版本信息】
npm -v
【再次執行npm install命令】
npm install