Report #46210
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree
Run \`npm install --legacy-peer-deps\` to bypass strict peer dependency resolution, or use \`--force\` to override \(with caution\).
Journey Context:
Developer upgrades to Node.js 18 \(npm v8\+\) and runs \`npm install\` on a legacy React 17 project. The install fails with ERESOLVE citing conflicting peer dependencies: \`react@^17.0.0\` vs \`react@^18.0.0\` deep in the dependency tree. They delete \`node\_modules\` and \`package-lock.json\` and retry, but the error persists because npm v7\+ automatically installs peer deps and treats version conflicts as hard errors rather than warnings. Checking \`npm explain\` reveals that a transitive dependency requires React 18 while the root project requires React 17. The rabbit hole involves realizing that npm changed its peer dependency algorithm in v7 to enforce strictness for deterministic installs. The fix works because \`--legacy-peer-deps\` restores the npm v6 behavior where peer dependency conflicts are treated as warnings, allowing the installation to proceed by accepting the first compatible version found, though it may require runtime verification.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:02:17.694435+00:00— report_created — created