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.

@material-ui/core incompatible with next.js

See original GitHub issue
  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

When using next.js versions >= 8.0.5-canary.11 I am not able to use certain components of @material-ui/core@3.9.3. If I downgrade to @material-ui/core@3.3.0 there is no issue.

On the flip side, I can use next.js versions <= 8.0.5-canary.10 with @material-ui/core@3.9.3 (and proabably any other version)

The issue appears to only happen when I import and use a ListItem, though It’s possible others have the same issue.

this seems to be the same issue but was closed

Additional notes:

Expected Behavior 🤔

I should be able to build and start an app using a <ListItem> import and use the latest versions of next.js when using material-ui

Current Behavior 😯

I get a 500 error with the following output in the console:

TypeError: Cannot read property 'dense' of undefined                                                                                                                                                                                              
    at Object.children (/home/ubuntu/dev/mui-next/node_modules/@material-ui/core/ListItem/MergeListContext.js:27:31)                                                                                                                              
    at a.render (/home/ubuntu/dev/mui-next/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:64)
    at a.read (/home/ubuntu/dev/mui-next/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:58)
    at renderToString (/home/ubuntu/dev/mui-next/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:53:83)
    at render (/home/ubuntu/dev/mui-next/node_modules/next-server/dist/server/render.js:83:16)
    at renderPage (/home/ubuntu/dev/mui-next/node_modules/next-server/dist/server/render.js:201:20)
    at Function.value (/home/ubuntu/dev/mui-next/.next/server/static/NF5o8EJCIiIS3Bbj1tDFL/pages/_document.js:808:41)
    at Object.loadGetInitialProps (/home/ubuntu/dev/mui-next/node_modules/next-server/dist/lib/utils.js:42:35)
    at Object.renderToHTML (/home/ubuntu/dev/mui-next/node_modules/next-server/dist/server/render.js:207:36)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Steps to Reproduce 🕹

Link: https://codesandbox.io/s/nrnx4p6q4p

repo: https://github.com/jaycenhorton/next-mui-errors

Context 🔦

Your Environment 🌎

Tech Version
Material-UI ^ v3.9.3
React 16.8.6
next ^ 8.0.5-canary.11

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
oliviertassinaricommented, Apr 27, 2019
1reaction
oliviertassinaricommented, May 16, 2019

@samuelkurdz I believe you need to revert back to v8.0.4: https://github.com/zeit/next.js/releases/tag/v8.0.4.

Read more comments on GitHub >

github_iconTop Results From Across the Web

material-ui/core incompatible with next.js · Issue #15505
When using next.js versions >= 8.0.5-canary.11 I am not able to use certain components of @material-ui/core@3.9.3 . If I downgrade to @material- ...
Read more >
Problem in Installing Material ui with next js (with and without ...
npm ERR! i have tried to use the material ui component and got a compiler error, even though i have tried in a...
Read more >
Supported platforms - Material UI - MUI
MUI supports the latest, stable releases of all major browsers and platforms. You don't need to provide any JavaScript polyfill as it manages...
Read more >
Advanced Features: Next.js Compiler
Unsupported Features​​ babelrc file, Next. js will automatically fall back to using Babel for transforming individual files.
Read more >
fix the upstream dependency conflict or retry material ui
npm install @material-ui/core gatsby-plugin-material-ui --legacy-peer-deps. Open side panel. Problem in Installing Material ui with next js (with and ...
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