Report #7453
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Add --legacy-peer-deps to the install command \(npm install --legacy-peer-deps\) to restore npm 6.x peer dependency behavior, or manually align the conflicting dependency versions in package.json to satisfy the strict tree check.
Journey Context:
Developer upgrades from npm 6 to npm 8 and runs npm install on an existing React project. Instead of success, the install aborts with ERESOLVE citing a conflict between [email protected] and a library requiring react@^17.0.0. Developer initially suspects corruption, deletes node\_modules and package-lock.json, retries, same error. Diving into npm changelog discovers npm 7\+ now auto-installs peer dependencies and enforces strict tree validation. The 'aha' moment comes from realizing the project relied on loose peer dep warnings, not strict failures. Applying --legacy-peer-deps bypasses the strict check, or alternatively, the developer updates the library to a version supporting React 18, fixing the tree properly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:45:01.080960+00:00— report_created — created