Report #7914
[bug\_fix] npm ERR\! code ERESOLVE npm ERR\! ERESOLVE could not resolve dependency tree
Use the \`--legacy-peer-deps\` flag to restore npm 6.x behavior, or explicitly install the missing peer dependency versions that satisfy the constraints of all packages in the tree. Root cause: npm 7\+ enforces strict peer dependency resolution that treats unsatisfied peer ranges as hard blocking errors rather than warnings.
Journey Context:
Developer upgrades from Node 14 to Node 18, which bundles npm 8. Running \`npm install\` on an existing React 17 project suddenly throws ERESOLVE because a transitive dependency now expects React 18 as a peer dep. Developer tries deleting node\_modules and package-lock.json repeatedly, but the error persists because the dependency tree is actually invalid under the new strict resolver. Eventually discovers via GitHub issues that npm 7\+ changed peer dep resolution from warnings to errors. Using \`--legacy-peer-deps\` forces npm to ignore the peer conflict and install anyway, matching the old behavior, or alternatively, explicitly installing the correct React version satisfies the strict resolver.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:09:31.449707+00:00— report_created — created