Skip to content
nkNilay Kabariya

Entry No.006·Fixes··1 min read

Fix: npm ERESOLVE unable to resolve dependency tree (React 19)

npm refuses to install a package whose peer range doesn't include your React version. Four fixes compared, and why --legacy-peer-deps alone breaks later.

by Nilay#npm#react#dependenciesFIXED

The error, verbatim

Jump to the fix ↓
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error Found: react@19.3.0
npm error Could not resolve dependency:
npm error peer react@"^16.8.5 || ^17.0.0 || ^18.0.0" from react-beautiful-dnd@13.1.1
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps

Tested on

npm / Node
11.9.0 / 24.14.0
react
19.3.0
Conflict
react-beautiful-dnd 13.1.1
OS
Windows 11 Pro
Contents
  1. The fix01
  2. What didn’t work02
  3. Why it happens03

The fix

Read the peer line in the error. One package says it only supports older React (here ^16 || ^17 || ^18) while you have React 19. Pick one of these, from best to quickest:

1. Switch to a package that supports your React version (best)

Most abandoned packages have a maintained fork or successor. For react-beautiful-dnd that’s @hello-pangea/dnd, which declares react: ^18.0.0 || ^19.0.0:

npm install @hello-pangea/dnd

2. Tell npm the peer is fine, in package.json (overrides)

If you’ve checked that the package works with your React version, record that in package.json so every future install respects it:

{
  "overrides": {
    "react-beautiful-dnd": {
      "react": "$react",
      "react-dom": "$react-dom"
    }
  }
}

$react means “whatever version of react the root project uses”.

3. Turn off strict peer checks for the project (.npmrc)

legacy-peer-deps=true

4. One-off flag

npm install --legacy-peer-deps

This works for that one command. But see below.

What didn’t work

Why it happens

Since npm 7, npm installs peer dependencies automatically and treats an unmatched peer range as an error. React 19 is newer than many packages’ declared ranges, so upgrading React, or starting a new project on it, triggers this for any package that hasn’t updated its peerDependencies.

Installing past the error doesn’t mean the package actually works on React 19. That only tells you npm stopped complaining. Test the feature you use from it.

— N.K., end of entry No.006

Useful? Pass it on:Post on X

Related entries

  1. No.007

    Fix: npx tailwindcss init “could not determine executable to run”

    Tailwind CSS v4 removed the init command, so npx has nothing to run. Two fixes, both reproduced: set up v4 without a config file, or pin v3.

    > $ npx tailwindcss init

    FIXED2 min
  2. No.010

    Fix: Vite “Failed to resolve import” for @ alias imports

    Vite can't find an @/ import until the alias is in vite.config. Why tsconfig paths alone don't help, and the new Vite 8 Rolldown wording. Reproduced.

    > [vite] Internal server error: Failed to resolve import "@/utils/hello"

    FIXED1 min
  3. No.009

    Fix: “trying to use tailwindcss directly as a PostCSS plugin”

    Tailwind CSS v4 moved its PostCSS plugin to a separate package. The two-line change to postcss.config.js, reproduced and verified.

    > Error: It looks like you're trying to use `tailwindcss` directly as a PostCSS

    FIXED1 min

Post card · Newsletter

Get the next fix in your inbox.

One short email when a new entry is published. No spam, never shared, and you can leave any time.

— Nilay

or follow by RSS

By subscribing you agree to the privacy note. One click to leave.

tip: paste the exact error text