npm: npm ERR! code ERESOLVE unable to resolve dependency tree
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! Could not resolve dependency: peer react@"^18.0.0" from some-package@1.0.0
Immediate Remediation
bash
# Option 1: Install with legacy peer deps resolution:
npm install --legacy-peer-deps
# Option 2 (Recommended): If using pnpm, add override in package.json:
{
"pnpm": {
"overrides": {
"react": "^19.0.0"
}
}
}Root Cause Analysis
npm v7+ strictly enforces peer dependency versions. When a transitive dependency specifies react@^18 and your project uses react@19, installation aborts.
Verification & Guardrails
- Only use --legacy-peer-deps or --force if you have verified the library operates on the newer major runtime.
- Check if a newer beta/next release of the offending package supports the updated peer.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.