Report #5111
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree - Conflicting peer dependency
Install with the \`--legacy-peer-deps\` flag to restore npm v6 behavior \(ignoring peer dep conflicts\), or add an \`overrides\` field in package.json to force a specific version resolution.
Journey Context:
Developer upgrades to Node 16/18 which bundles npm 7\+. Attempting to install a package \(e.g., an older React library\) immediately throws ERESOLVE, complaining that React 17 is required but React 18 is present. Deleting node\_modules and the lockfile and reinstalling fails with the same error. The developer discovers that npm v7\+ automatically installs peer dependencies by default, whereas npm v6 ignored them. Realizing the conflict is between the project's React version and a legacy library's peer requirement, the developer runs \`npm install --legacy-peer-deps\`, which succeeds by reverting to the v6 resolution algorithm. Alternatively, they could use \`npm config set legacy-peer-deps true\` to persist the fix.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:40:37.527156+00:00— report_created — created