Report #93749
[bug\_fix] ERESOLVE unable to resolve dependency tree
Add the \`--legacy-peer-deps\` flag to \`npm install\` \(e.g., \`npm install --legacy-peer-deps\`\) or set \`legacy-peer-deps=true\` in \`.npmrc\`.
Journey Context:
You upgrade your CI runner to Node 18 \(which ships npm 8\) and suddenly \`npm ci\` fails with a cryptic ERESOLVE error pointing at a React library. You nuke \`node\_modules\` and the lock file, but \`npm install\` still crashes, claiming conflicting peer dependencies between \`react@18\` and a library expecting \`react@17\`. You try \`--force\`, which lets the install finish but causes runtime Context API failures. Digging into the npm RFCs, you realize npm 7\+ changed the peer dependency resolution algorithm to automatically install peers and enforce strict tree validation. The \`--legacy-peer-deps\` flag restores the npm 6 behavior, ignoring the peer conflict and letting the existing hoisting strategy work as it did before the upgrade.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:56:42.535080+00:00— report_created — created