Derickoh
Derickoh

Reputation: 1

npm install react-router-dom install error

I have tried several times to install react-router-dom in my react project but it keeps on giving me the following error:

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @material-ui/[email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! peer react@"^18.0.0" from @testing-library/[email protected] npm ERR!
node_modules/@testing-library/react npm ERR!
@testing-library/react@"^13.4.0" from the root project npm ERR! peer react@"^18.2.0" from [email protected] npm ERR!
node_modules/react-dom npm ERR! peer react-dom@"^18.0.0" from @testing-library/[email protected] npm ERR!
node_modules/@testing-library/react npm ERR!
@testing-library/react@"^13.4.0" from the root project npm ERR! peer react-dom@">=16.6.0" from [email protected] npm ERR! node_modules/react-transition-group npm ERR!
react-transition-group@"^4.4.0" from @material-ui/[email protected] npm ERR! node_modules/@material-ui/core npm ERR! peer @material-ui/core@"^4.0.0" from @material-ui/[email protected] npm ERR!
node_modules/@material-ui/icons npm ERR! 1 more (the root project) npm ERR! 2 more (the root project, react-router-dom) npm ERR! 5 more (react-router, react-scripts, react-transition-group, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/[email protected] npm ERR! node_modules/@material-ui/core npm ERR! peer @material-ui/core@"^4.0.0" from @material-ui/[email protected] npm ERR!
node_modules/@material-ui/icons npm ERR!
@material-ui/icons@"^4.11.3" from the root project npm ERR!
@material-ui/core@"^4.12.4" from the root project npm ERR! npm ERR! Conflicting peer dependency: [email protected] npm ERR! node_modules/react npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/[email protected] npm ERR! node_modules/@material-ui/core npm ERR! peer @material-ui/core@"^4.0.0" from @material-ui/[email protected] ERR! node_modules/@material-ui/icons npm ERR! @material-ui/icons@"^4.11.3" from the root project npm ERR! @material-ui/core@"^4.12.4" 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\NKEM AWA\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\User Name\AppData\Local\npm-cache_logs\2022-10-31T18_23_30_712Z-debug-0.log

Please if you know how to resolve this help. I am using the [email protected]

npm install react-router-dom as per the Router manual and it kept on giving me an error. I wanted to use route in the project but I am unable to do so because of this installation error.

Upvotes: 0

Views: 1673

Answers (1)

dtm
dtm

Reputation: 213

You got this error because your materialui version is peer dependency with react 16.8.0 || ^17.0.0

You can fix this error by install lower react version

Upvotes: 0

Related Questions