Report #98654
[bug\_fix] npm ERR\! ERESOLVE unable to resolve dependency tree — peer dependency conflict
Run the install with \`npm install --legacy-peer-deps\` \(or \`--force\` only as a last resort\). In npm 7\+, the resolver strictly enforces peer dependencies; \`--legacy-peer-deps\` restores the npm 6 behavior of tolerating peer-dependency mismatches so the tree can resolve. The real fix is to align the peer dependency ranges in your direct dependencies, but \`--legacy-peer-deps\` unblocks the install immediately.
Journey Context:
You scaffold a new project with \`npm create vite@latest\`, then \`npm install\` a UI library that hasn't updated its React peer dependency to React 19 yet. The install explodes with \`ERESOLVE unable to resolve dependency tree\`. You try deleting \`node\_modules\` and \`package-lock.json\`; the error returns. You Google the code and learn that npm 7 switched to a stricter peer-dependency resolver. You try \`npm install --force\`, which works but overrides everything blindly. Then you discover \`--legacy-peer-deps\`, which tells npm to ignore peer conflicts the way npm 6 did. The install succeeds, the app boots, and you pin a note to upgrade the UI library once it supports React 19.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:33:23.392750+00:00— report_created — created