0

The only thing done before this is npx create-react-app ./

npm install @material-ui/core @material-ui/icons @material-ui/lab @react-google-maps/api axios google-map-react

after running this I am getting the next error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: travel_advisor@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.0 || ^17.0.0" from @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR!   @material-ui/core@"*" 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\User\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\AppData\Local\npm-cache\_logs\2022-08-27T18_43_01_094Z-debug-0.log
PS C:\Users\User\Desktop\travel_advisor>

I have tried updating npm with npm install -g npm but it doesn't change anything

Tea
  • 3
  • 3
  • Looks like downgrading it to npm6 with `npm install -g npm@6` works, is that a good way? – Tea Aug 27 '22 at 18:57
  • try ```npm install @material-ui/core @material-ui/icons @material-ui/lab @react-google-maps/api axios google-map-react --legacy-peer-deps``` – Harsh Gupta Aug 27 '22 at 19:00
  • after downgrading and trying again, here's what I got: – Tea Aug 27 '22 at 19:02
  • Does this answer your question? [What does npm install --legacy-peer-deps do exactly? When is it recommended / What's a potential use case?](https://stackoverflow.com/questions/66239691/what-does-npm-install-legacy-peer-deps-do-exactly-when-is-it-recommended-wh) – Ahmed Shaqanbi Aug 27 '22 at 20:22

2 Answers2

1

try this

npm install @material-ui/core @material-ui/icons @material-ui/lab @react-google-maps/api axios google-map-react --force

or try to install packages once at a time. That way you can understand which one causing problem with peer dependency

Arijit Maiti
  • 99
  • 2
  • 8
0

@material-ui/core depends on react ^16.8 or ^17.0, you installed react 18.2

Try the new material-ui v5:

npm install @mui/material @emotion/react @emotion/styled

https://mui.com/

tobiv
  • 821
  • 1
  • 8
  • 20