Report #93578
[bug\_fix] npm ERR\! code ERESOLVE could not resolve dependency tree
Run \`npm install --legacy-peer-deps\` to revert to npm v6 peer dependency behavior, or manually resolve the conflict by upgrading the conflicting packages. Root cause: npm v7\+ uses @npmcli/arborist which treats peer dependency conflicts as hard errors rather than warnings.
Journey Context:
You upgrade to Node 18 which bundles npm v8. Running \`npm install\` on a legacy React 16 project suddenly throws ERESOLVE errors mentioning conflicting peer deps for react across transitive dependencies. You delete node\_modules and the lockfile, but the error persists because the resolver is now strict. Using \`npm explain\`, you see two different React version ranges being demanded. You realize npm v7\+ enforces peer dependencies strictly to avoid runtime singleton issues. The \`--legacy-peer-deps\` flag restores the v6 behavior where conflicts are warnings, allowing the install to proceed by picking one version, though you may need to ensure runtime compatibility yourself.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:39:24.164394+00:00— report_created — created