material-ui: MUI v5.11.8 release breaks build of NextJS v13.1.6
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Steps to reproduce 🕹
Screenshot:

Steps:
- Upgrade to any of the MUI packages from above screenshot, with a latest nextJS install, that has routes in the pages folder.
- Run a next build.
- Expect the following error:

Current behavior 😯
No response
Expected behavior 🤔
No response
Context 🔦
No response
Your environment 🌎
npx @mui/envinfo
System:
OS: macOS 13.2
Binaries:
Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node
Yarn: Not Found
npm: 9.3.1 - ~/.nvm/versions/node/v18.14.0/bin/npm
Browsers:
Chrome: 109.0.5414.119
Edge: Not Found
Firefox: 107.0
Safari: 16.3
npmPackages:
@emotion/react: ^11.10.5 => 11.10.5
@emotion/styled: ^11.10.5 => 11.10.5
@mui/base: ^5.0.0-alpha.116 => 5.0.0-alpha.116
@mui/core-downloads-tracker: 5.11.8
@mui/icons-material: ^5.11.0 => 5.11.0
@mui/lab: ^5.0.0-alpha.118 => 5.0.0-alpha.118
@mui/material: ^5.11.8 => 5.11.8
@mui/private-theming: 5.11.7
@mui/styled-engine: 5.11.8
@mui/system: ^5.11.7 => 5.11.8
@mui/types: 7.2.3
@mui/utils: 5.11.7
@types/react: ^18.0.27 => 18.0.27
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
typescript: ^4.9.5 => 4.9.5
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 17 (5 by maintainers)
our workaround is to tell our package manager to install the previous version of
@mui/styled-engine:Yeah, I think it could be related as the problematic line in
@emotion/styled/baseis the following:which based on the above mentioned could indeed have
cache-undefined when trying to access theregistered-property when the page is being rendered in SSR mode as thendocumentwill beundefinedRemoving the StyledEngineProvider removes the error
TypeError: Cannot read properties of undefined (reading 'registered')on our side, the build fails with NextJS 12.3.4 and this stacktrace: