Report #9098
[bug\_fix] npm ERR\! ERESOLVE could not resolve
Add --legacy-peer-deps to npm install or update conflicting dependencies to compatible peer ranges. Root cause: npm 7\+ enforces strict peer dependency resolution; when the dependency tree contains incompatible peer ranges \(e.g., React 17 vs 18\), the resolver halts instead of ignoring the conflict like npm 6.
Journey Context:
After upgrading to Node 18 \(npm 8\), running npm install on an existing enterprise React project immediately fails with 'ERESOLVE unable to resolve dependency tree'. The error points to a conflict between [email protected] and a design-system package requiring react@>=18. The developer attempts deleting node\_modules and package-lock.json, but the error persists because the peer conflict is legitimate. Searching reveals npm 7 changed peer dep handling. They try npm install --force, which works but risks runtime crashes. Finally, they use --legacy-peer-deps to temporarily restore npm 6 behavior, allowing the install to complete while the team schedules a React 18 migration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:16:39.404507+00:00— report_created — created