ERROR: ERESOLVE unable to resolve dependency tree

 

Recently started to play with Laravel/React project when I did my npm install, i got this error message and this is how I was able to solve it.

15t@LAPTOP-D80P87P4 MINGW64 /g/xampp8/htdocs/laravel/TUTORIALS/react-laravel-tutorial      
$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/vite
npm ERR!   dev vite@"^4.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vite@"^3.0.0" from @vitejs/[email protected]
npm ERR! node_modules/@vitejs/plugin-react
npm ERR!   dev @vitejs/plugin-react@"^2.2.0" 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\15t\AppData\Local\npm-cache\_logs\2022-12-22T02_03_25_967Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\15t\AppData\Local\npm-cache\_logs\2022-12-22T02_03_25_967Z-debug-0.log

Solution:

Open package.json and:

CHANGE FROM:

"vite": "^4.0.0"

CHANGE TO:

"vite": "^3.0.0"