Report #50481
[bug\_fix] npm ERR\! code ERESOLVE npm ERR\! ERESOLVE unable to resolve dependency tree
Add the \`--legacy-peer-deps\` flag to \`npm install\` to restore pre-npm-7 peer dependency resolution behavior, or use \`--force\` to bypass validation. Root cause: npm 7\+ automatically installs peer dependencies and strictly validates the entire dependency tree for conflicts, whereas npm 6 ignored these conflicts.
Journey Context:
Developer upgrades to Node.js 18 \(npm 8\) and clones a legacy React project that worked last year. Running \`npm install\` throws a wall of ERESOLVE text citing unresolvable peer conflicts between React 17 and 18. They delete \`node\_modules\` and \`package-lock.json\` repeatedly, try different Node versions, but the error persists because it's the npm version that changed. They search the error code and find discussions about RFC 0025. Adding \`--legacy-peer-deps\` makes the install succeed immediately, revealing that npm 7 fundamentally changed peer dep resolution to be strict by default.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:12:51.368088+00:00— report_created — created