Report #74168
[bug\_fix] ERESOLVE unable to resolve dependency tree – npm 7\+ enforces peer dependencies strictly, causing installation failures when a package expects React 16 but the project uses React 17/18.
Run \`npm install --legacy-peer-deps\` to restore npm 6 peer-dependency behavior, or upgrade the conflicting package to a version compatible with your current React/dependency version.
Journey Context:
You upgrade from npm 6 to npm 7 \(or 8/9\) and attempt to install a package like \`react-scripts@4\` in a project using React 17. The install immediately fails with a verbose tree showing \`ERESOLVE\` and mentioning peer dependency conflicts. You try \`--force\`, which allows the install but later causes runtime 'Invalid hook call' errors because npm installed a duplicate React to satisfy the peer dep. After debugging hooks for an hour, you realize npm 7 auto-installs peer deps by default. You delete \`node\_modules\`, reinstall with \`--legacy-peer-deps\`, and the duplicate React disappears, fixing both the install and runtime errors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T07:05:32.893243+00:00— report_created — created