Back to Blog
Bug Fixes•1 min read

Fix 'npm ERR! ERESOLVE unable to resolve dependency tree'

Scaleup Infotech Team
Scaleup Infotech Team

Custom Software & Business Automation

npmDependenciesNode.js

In this guide

A simple guide to this issue: 'npm ERR! ERESOLVE unable to resolve dependency tree'. Learn why it happens, what to check first, and how to fix it.

Since npm 7, peer dependencies are enforced strictly. When two packages disagree about a peer (commonly React versions), the install aborts. Here is how to read the conflict and fix it the right way.

The Error

npm ERR! ERESOLVE unable to resolve dependency tree. Could not resolve dependency: peer react@"^18.0.0" from some-lib@2.0.0

Step 1: Read Who Wants What

The error names the package and the peer version it requires versus the version you have. That tells you whether to upgrade the dependent package or wait for it to support your version.

The Quick Unblock

bash
# Tells npm to use the older, lenient peer resolution
npm install --legacy-peer-deps

Warning

--force and --legacy-peer-deps install anyway, but the conflict is real. The library may genuinely not support your React version — test thoroughly before shipping.

The Proper Fix

  1. Upgrade the conflicting library to a version that supports your peer (npm install some-lib@latest).
  2. Or align your core dependency to the version the library expects.
  3. Pin the resolution in package.json overrides if you must force a single version across the tree.

Share this article:

Keep Reading

Ready to implement these ideas?

Discuss Your Project