Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

React cannot find the module @mui/x-data-grid

ErrorModule not found: Can't resolve '@mui/x-data-grid'

Short answer

The bundler cannot find the package in node_modules. @mui/x-data-grid is a separate package from @mui/material, so install it, along with @mui/material, @emotion/react and @emotion/styled. If you installed the Pro or Premium package, import from that package name instead.

  • Applies to @mui/x-data-grid 8, React 19, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask npm whether the package is installed in this project.

    npm ls @mui/x-data-grid @mui/material @emotion/react @emotion/styled
  2. 2Match what you see, then jump to its fix

    1. 1npm ls prints (empty) for @mui/x-data-gridThe data grid package is not installedFix
    2. 2Related can't-resolve errors for @mui/material or @emotion/reactThe Material UI and Emotion peers are missingFix
    3. 3package.json lists @mui/x-data-grid-pro or @mui/x-data-grid-premium onlyPro or Premium is installed but the import names the community packageFix

What does the error look like?

  • Module not found: Can't resolve '@mui/x-data-grid'

Cause 1 of 3

The data grid package is not installed

1Check

Check package.json for the dependency.

grep -n "x-data-grid" package.json

2Fix

Install the community package.

npm install @mui/x-data-grid

3Verify

npm ls lists it and the build passes.

npm ls @mui/x-data-grid

Confirmed by mui.com

Did this fix it?

Cause 2 of 3

The Material UI and Emotion peers are missing

1Check

The grid needs Material UI and Emotion beside it.

npm ls @mui/material @emotion/react @emotion/styled

2Fix

Install the three peers.

npm install @mui/material @emotion/react @emotion/styled

3Verify

Restart the dev server and open the page.

npm run dev

Confirmed by mui.com

Did this fix it?

Cause 3 of 3

Pro or Premium is installed but the import names the community package

1Check

Compare package.json with your import lines.

grep -rn "x-data-grid" package.json src/

2Fix

Import from the package you installed.

import { DataGridPro } from '@mui/x-data-grid-pro';

3Verify

The build resolves the import.

npm run build

Confirmed by mui.com

Did this fix it?

How do I stop it coming back?

  • Install the grid and its peers in one command when you add it.
  • Use one package (community, Pro or Premium) per project and import only from it.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.