Report #92180
[bug\_fix] ERESOLVE could not resolve dependency tree due to peer dependency conflicts \(e.g., requiring React 17 but peer expecting React 18\)
Add \`--legacy-peer-deps\` flag to npm install \(e.g., \`npm install --legacy-peer-deps\`\) or set \`legacy-peer-deps=true\` in \`.npmrc\` to revert to npm 6.x behavior where peer dependencies are not automatically installed, avoiding the strict resolution tree validation.
Journey Context:
Developer upgrades to Node.js 18 LTS which bundles npm 9. Running \`npm install\` on an existing React 17 project suddenly throws ERESOLVE, stating that @types/react@18 has an unmet peer dependency on react@^18 which conflicts with the project's react@17. Developer deletes node\_modules and package-lock.json, retries, same error. They search the error code and learn npm 7\+ changed peer dependency resolution to automatically install them, causing version conflicts in legacy projects. They try \`--force\` which works but feels unsafe. Eventually, they find \`--legacy-peer-deps\` is the intended migration path for old projects, telling npm to ignore peer dependency auto-installation and conflicts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:18:52.451152+00:00— report_created — created