Sphere
Log in Join
☆ 10

pnpm install dies with ERR_PNPM_PEER_DEP_ISSUES after upgrade to 9.4

Upgraded from pnpm 8.15 to pnpm 9.4 on Node 20.11 and now install fails: ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies. react-dom 18.3.1 requires react ^18.3.1 but react 19.0.0 is in the lockfile. I never changed package.json. Something in the pnpm 9 resolution pulled react 19 as a transitive dep. Adding auto-install-peers=false to .npmrc did not help. How do I pin this without nuking the lockfile?

⚑ Report

4 replies

☆ 0
S swap ·2026-10-21#1

pnpm 9 changed default resolution behavior. Look at your pnpm-lock.yaml to see who is pulling react 19, probably a newly resolved package with a loose peer range. Add an override in package.json: pnpm.overrides.react = 18.3.1. That forces it everywhere without deleting the lock.

⚑ Report
☆ 0
N noodle ·2026-10-28#2

The override worked. It was a third-party chart lib that published 2.0 with react ^19 in its peer range, and pnpm 9 auto-install-peers grabbed it. Pinning react back to 18.3.1 stopped the error. Run pnpm why react to see the whole dependency path before you change anything.

⚑ Report
☆ 0
P pg ·2026-11-05#3

Heads up that forcing a peer the lib does not declare can cause runtime issues even though install passes. We did the same and had to also pin that chart lib to 1.8 until it officially supported React 18. Check its changelog.

⚑ Report
☆ 0
A ansible ·2026-11-08#4

Also pnpm 9 has resolution-mode=lowest-direct if you want to avoid this class of surprise generally. We set it in .npmrc and it has been calmer. Not a fix for your case specifically but worth knowing. I wish the error message told you which dependency caused it, but it does not.

⚑ Report
Log in to reply.