Report #71948
[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 where peer dependency conflicts are treated as warnings rather than hard failures, or upgrade the conflicting packages to compatible versions.
Journey Context:
You upgraded to Node 18 which bundles npm 9. Running \`npm install\` in a legacy React project immediately throws \`ERESOLVE unable to resolve dependency tree\`. The error log shows that \`[email protected]\` conflicts with \`peer-react@"^17.0.0"\` required by an old testing library deep in the tree. You run \`npm ls react\` and see multiple versions being demanded. The strict resolution algorithm in npm 7\+ no longer allows this ambiguity. You consider upgrading the testing library, but that breaks other assertions. After checking the npm docs, you use \`npm install --legacy-peer-deps\`, which restores the pre-v7 behavior and allows the install to complete by flattening the peer dependency conflicts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:20:50.658753+00:00— report_created — created