question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to install @mui/styles on React 18.2.0

See original GitHub issue

while 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:closed
  • Created a year ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mnajdovacommented, Sep 29, 2022

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/

0reactions
barbalexcommented, Nov 22, 2022

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found