Fixing npm ERESOLVE Dependency Errors on Windows (with Screenshot)
A quick fix for dependency tree conflicts when installing packages with npm on Windows
If you've run into a nasty dependency error while running npm install
on Windows, you’re not alone.
Here’s an example of what it might look like:
(Replace this with your actual image)
This is the ERESOLVE
error — it usually means that two packages are asking for conflicting versions of the same dependency. In this case, it happened with date-fns
and react-day-picker
.
Quick Fix
You can bypass the error by adding the --legacy-peer-deps
flag:
npm install --legacy-peer-deps
This tells npm to ignore peer dependency conflicts, which is especially useful when you’re just trying to get things running locally.
Why this works
Npm v7+ introduced stricter rules around peer dependencies. While this helps with long-term stability, it can block local installs when package authors haven’t updated their dependencies.
Using --legacy-peer-deps
reverts to npm v6 behavior. It’s not ideal for production, but it’s a safe and fast workaround for local dev environments.