npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: my-v0-project@0.1.0 npm ERR! Found: date-fns@4.1.0 npm ERR! node_modules/date-fns npm ERR! date-fns@"4.1.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer date-fns@"^2.28.0 || ^3.0.0" from react-day-picker@8.10.1 npm ERR! node_modules/react-day-picker npm ERR! react-day-picker@"8.10.1" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! npm ERR! For a full report see: npm ERR! C:\Users\Nishant\AppData\Local\npm-cache_logs\2025-04-24T09_04_46_708Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: C:\Users\Nishant\AppData\Local\npm-cache_logs\2025-04-24T09_04_46_708Z-debug-0.log
Dependency Conflict: date-fns and react-day-picker
You're encountering a dependency conflict between date-fns
and react-day-picker
:
- Your project has
date-fns@4.1.0
installed - But
react-day-picker@8.10.1
requiresdate-fns
version^2.28.0 || ^3.0.0
Solution Options
Option 1: Downgrade date-fns (Recommended)
npm uninstall date-fns
npm install date-fns@3.3.1
This installs the latest version of date-fns v3, which is compatible with react-day-picker.
Option 2: Use a newer react-day-picker version
Check if there's a newer version of react-day-picker that supports date-fns v4:
npm view react-day-picker versions
If a compatible version exists, install it:
npm install react-day-picker@newer-version
Option 3: Force installation (Not recommended)
You can bypass the dependency check, but this might cause runtime issues:
npm install --legacy-peer-deps
Or:
npm install --force
Option 4: Use pnpm or Yarn
These package managers sometimes handle peer dependency conflicts better:
# Using pnpm
pnpm install
# Using Yarn
yarn