r/learnreactjs • u/BilboMcDoogle • Jul 17 '22
What does this error mean? Can't resolve peer dependency? How to fix?
Sorry if noob question and thanks for clicking but I'm trying to install material-ui icons by doing:
npm install @material-ui/iconsBut i keep getting this error and IDK what it means:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: netflix@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! peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
npm ERR! node_modules/@material-ui/icons
npm ERR! @material-ui/icons@"*" 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 /home/user/.npm/eresolve-report.txt for a full report.Im doing exactly what the documentation says to do?
5
Upvotes
1
u/[deleted] Jul 17 '22
It looks like react version needs to be upgraded. The version used by your project isn’t compatible
2
u/____0____0____ Jul 17 '22
Material UI renamed their entire ecosystem in v5 to to use @mui scope
https://www.npmjs.com/package/@mui/icons-material
React 18 came out after v5, so the support for it would be after that as well. That being said, many libraries will continue to just work with React 18 because it wasnt a giant api shift.
1
u/CommercialNinja6598 Aug 14 '22
Did you find any solution ? I am facing the same problem
1
u/Murky-Bridge2793 Oct 05 '22
just change your react and react-dom dependencies to 17.0.2
and run npm install