Unable to install @mui/styles on React 18.2.0
See original GitHub issuewhile trying to install @mui/styles using npm i @mui/styles
on React 18.2.0 getting this down below error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: client-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@"^17.0.0" from @mui/styles@5.10.6
npm ERR! node_modules/@mui/styles
npm ERR! @mui/styles@"*" 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\Sajib\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\Sajib\AppData\Local\npm-cache\_logs\2022-09-20T04_02_37_278Z-debug-0.log
Note: I don’t want to go back to the older version of React. And command with ‘’–force, or --legacy-peer-deps’’ doesn’t help me. The project I am working on was initially on React 16, now after one year, I am trying to run it. While I am on React 18.
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Cannot install @mui/styles in React - Stack Overflow
ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: my-app@0.1.0 npm ERR! Found: react@18.2.0 npm ERR!
Read more >Cannot install @mui/styles · Issue #33066 · mui/material-ui
Uncaught Error: MUI: withStyles is no longer exported from @mui/material/styles. You have to import it from @mui/styles. npm ERR! npm ERR!
Read more >@mui/styles - npm
You can leverage our styling solution, even if you are not using our components. Installation. Install the package in your project directory with:...
Read more >Installation - Material UI - MUI
Install Material UI, the world's most popular React UI framework. Default installation. Run one of the following commands to add Material UI to...
Read more >module not found: error: can't resolve '@mui/material/button'
Try running npm install --save babel-loader and compile again. If that doesn't work, try reinstalling all dependencies npm ci and compile again. Open...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This package is not compatible with React 18, there is a warning on the start of the docs page about it - https://mui.com/system/styles/basics/
This was the solution to an epic issue that cost us literally multiple days (https://github.com/gatsbyjs/gatsby/discussions/37051). @mnajdova Thanks so much for the hint!