Report #39036
[bug\_fix] npm ERR\! code ERESOLVE unable to resolve dependency tree
Run npm install with the --legacy-peer-deps flag, or downgrade to npm 6, or manually upgrade the conflicting peer dependency to a compatible version. Root cause: npm 7\+ automatically installs peer dependencies and enforces strict semver matching, turning previous peer conflicts from warnings into hard ERESOLVE errors.
Journey Context:
You clone a legacy React 17 project and run npm install. Instead of success, you get ERESOLVE citing a conflict between [email protected] and [email protected] required by a newer devDependency. You delete node\_modules and package-lock.json repeatedly, but the error persists. You check your npm version and see 9.x. You realize that npm 6 would have installed this with only a warning. You search the npm docs for ERESOLVE and find the --legacy-peer-deps flag, which restores the npm 6 peer dependency resolution algorithm. Using npm install --legacy-peer-deps works immediately because it ignores the strict peer dependency tree validation, allowing the incompatible versions to coexist as they did before.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:59:32.285361+00:00— report_created — created