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.

'experimental_sx' is not exported from '@mui/system'

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example:

Steps:

  1. Use experimental_sx in the app 2.npm install & run the app 3.It will show (./node_modules/@mui/material/esm/styles/index.js Attempted import error: ‘experimental_sx’ is not exported from ‘@mui/system’.)

Current behavior 😯

The app is crashing.

Expected behavior 🤔

No response

Context 🔦

It is imported like this : import {adaptV4Theme, createTheme, responsiveFontSizes, experimental_sx as sx, alpha, lighten} from ‘@mui/material/styles’;

This code was untouched for months and was working fine till yesterday.

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
corneliugainacommented, Dec 15, 2022

Indeed @siriwatknp , updating package json solves the problem.

I had the same issue yesterday, I think that eventually the @mui/material was behind @mui/styles, speaking of version compatibility. Yesterday the 5.11.0 was released with a breaking change https://github.com/mui/material-ui/pull/35150

So @mui/styles ^5.8.6 is using releases from 5.8.6 to < 5.11.0, but @mui/material stays at 5.8.6. The solution is to update both and/or add the caret. Then, a little npm ci and you’re good.

Screenshot by Dropbox Capture

For reminder ^version “Compatible with version”, will update you to all future minor/patch versions, without incrementing the major version. This is explicited in mui versioning strategy documentation.

1reaction
siriwatknpcommented, Dec 15, 2022

Thanks @siriwatknp , I have changed the code but the issue still exists as it is showing the import error from the file inside the node_modules. I tried removing and npm install again but still it is the same. This is the error showing :

./node_modules/@mui/material/esm/styles/index.js Attempted import error: ‘experimental_sx’ is not exported from ‘@mui/system’.

I went to this particular file and removed the experimental_xs from that file which is in the @mui folder inside the node_modules package then the app worked fine.

Can you provide which version of @mui/* do you have in your package.json?

Also, can you try with the latest version @mui/material: "^5.11.0"?

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - React build failed with error export 'experimental_sx ...
Failed to compile. export 'experimental_sx' (reexported as 'experimental_sx') was not found in '@mui/ ...
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.
Read more >
emotion/babel plugin not working with `experimentalStyled as ...
We are currently working on adding documentation for the experimentalStyled() (will be soon exported as a styled() from @material-ui/core/styles ...
Read more >
export 'import_react3' is not defined in module - You.com
Apparently since I am using MUI I need to install @emotion/react and ... (those not in the GOTINKER tree) using the standard module...
Read more >
Introducing the New JSX Transform – React Blog
This upgrade will not change the JSX syntax and is not required. ... React in order to use Hooks or other exports that...
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