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.

Makestyles "You have to import it from @mui/styles" error when doing just that

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

I’m getting the error

 MUI: makeStyles is no longer exported from @mui/material/styles.
    You have to import it from @mui/styles.

But i’m already doing that. there is no instance of any material/styles in my code, only @mui/styles.

for example one of the erroring files starts like this:

import { ReactElement } from "react";
import { makeStyles } from "@mui/styles";

const useStyles = makeStyles({

...

Expected behavior 🤔

I don’t receive an error.

Steps to reproduce 🕹

Cannot create repro steps

Context 🔦

No response

Your environment 🌎

`npx @mui/envinfo`
System:
    OS: macOS 12.0.1
  Binaries:
    Node: 14.17.0 - ~/.volta/tools/image/node/14.17.0/bin/node
    Yarn: 1.22.5 - ~/.volta/tools/image/yarn/1.22.5/bin/yarn
    npm: 6.14.13 - ~/.volta/tools/image/node/14.17.0/bin/npm
  Browsers:
    Chrome: 99.0.4844.51
    Edge: Not Found
    Firefox: Not Found
    Safari: 15.1
  npmPackages:
    @emotion/react:  11.8.1 
    @emotion/styled:  11.8.1 
    @mui/base:  5.0.0-alpha.71 
    @mui/icons-material:  5.5.0 
    @mui/material:  5.5.0 
    @mui/private-theming:  5.4.4 
    @mui/styled-engine:  5.4.4 
    @mui/styles:  5.5.0 
    @mui/system:  5.5.0 
    @mui/types:  7.1.2 
    @mui/utils:  5.4.4 
    @types/react: ^17.0.38 => 17.0.38 
    react: ^17.0.2 => 17.0.2 
    react-dom: ^17.0.2 => 17.0.2 
    typescript: ^4.3.5 => 4.5.4 

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
austinthetacocommented, Mar 15, 2022

Got it, thanks!

0reactions
DominicGBauercommented, Nov 18, 2022

@mnajdova don’t you need to use import { createTheme } from '@mui/material/styles';? How would you do this without getting the Error: MUI: makeStyles is no longer exported from @mui/material/styles. error?

Read more comments on GitHub >

github_iconTop Results From Across the Web

makeStyles is not longer exported from @mui/material/styles ...
Even I am importing from @mui/styles all over in my project but still it is showing this error. I removed node_modules and reinstalled...
Read more >
Troubleshooting - Material UI - MUI
This error arises because makeStyles is now exported from the @mui/styles package, which does not know about Theme in the core package. To...
Read more >
Visual issues of React Material UI after migrating from v4 to v5
Importing makeStyles from two different places means that we are using two different versions of it, from two different versions of Material UI....
Read more >
Module not found: Error: Can't resolve '@mui/styles' Material UI
Module not found: Error : Can 't resolve '@ mui/styles ' Material UIPlease do like share and comment if you like the video...
Read more >
Migrate Material-UI 4 to Mui-5 - DEV Community ‍ ‍
now we need to import it to entry point like where you're wrapping ... another solution to migrate the makeStyles to styled using...
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