-2

PS C:\Users\OneDrive\Desktop\MERN Project\frontend> npm i react-alert npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: frontend@0.1.0 npm ERR! Found: react@18.2.0 npm ERR! node_modules/react npm ERR! react@"^18.2.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.8.1 || ^17" from react-alert@7.0.3 npm ERR! node_modules/react-alert npm ERR! react-alert@"*" 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! See C:\Users\lodhi\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\lodhi\AppData\Local\npm-cache_logs\2022-10-05T08_57_49_898Z-debug-0.log

  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 05 '22 at 11:28
  • This is a very poor question, you just posted an error message without any commentary or discussion on what you tried to solve the error. The only other question you've asked is likewise a poorly structured question. Please read [this post on how to ask questions](https://stackoverflow.com/help/how-to-ask). – Nathan Oct 08 '22 at 20:06

1 Answers1

1

This happens when the package you're installing has a different version compared to your local package. There are 2 ways to solve this issue.

The first way ( easy way )

Just do npm install packagename --legacy-peer-deps or npm install packagename --force

The second way ( hard way )

If the above doesnt work, then you need to figure out which packages are causing conflict and add this line into your package.json

#for npm users
overrides: {
packagename: "add local version here"
}


#for yarn users
resolutions: {
packagename: "add local version here"
}
Vin Xi
  • 986
  • 2
  • 11