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
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