Report #37661
[bug\_fix] npm ERR\! ERESOLVE could not resolve dependency tree with peer dependencies
Add --legacy-peer-deps flag to npm install to restore npm 6.x peer dependency handling, or manually align the conflicting peer dependency versions in package.json to satisfy the strict tree constraint.
Journey Context:
Developer upgrades to npm 7\+ and runs npm install on an existing React project. The install fails with ERESOLVE, displaying a complex conflict tree \(e.g., Found: [email protected], required: react@^17.0.0 by some-legacy-lib\). Confused because the project installed fine yesterday, they check the npm version and realize npm 7 introduced automatic peer dependency installation and strict validation. They search the error code and find npm documentation explaining that --legacy-peer-deps bypasses the new strict peer resolution algorithm. They run npm install --legacy-peer-deps, the install succeeds, and they document the need to eventually upgrade the legacy library to support React 18.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T17:41:43.323397+00:00— report_created — created