mui-datatables: Module not found: Error: Can't resolve '@mui/styles'

Hi all, I am new to using Mui-datatables and I am currently running into this issue. Any idea if I’ve done anything wrong or is it a bug?

Current Behavior

Module not found: Error: Can’t resolve ‘@mui/styles

Steps to Reproduce (for bugs)

  1. npx create-react-app test
  2. cd test
  3. npm install @mui/material @emotion/react @emotion/styled @mui/icons-material --save
  4. npm install mui-datatables --save
  5. npm start

My App.js:

import React from "react";
import MUIDataTable from "mui-datatables";

function App() {
  const columns = ["Name", "Company", "City", "State"];

  const data = [
    ["Joe James", "Test Corp", "Yonkers", "NY"],
    ["John Walsh", "Test Corp", "Hartford", "CT"],
    ["Bob Herm", "Test Corp", "Tampa", "FL"],
    ["James Houston", "Test Corp", "Dallas", "TX"],
  ];

  const options = {
    filterType: "checkbox",
  };

  return (
    <MUIDataTable
      title={"Employee List"}
      data={data}
      columns={columns}
      options={options}
    />
  );
}

export default App;

Any help would be greatly appreciated!

Your Environment

Tech Version
Material-UI 5.4.1
MUI-datatables 4.0.0
React 17.0.2
browser Chrome
etc

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (3 by maintainers)

Most upvoted comments

Can someone mark it as bug?

use npm install @mui/styles --save adding --save will help you

@kevintruo hope that this PR will help with your issue https://github.com/gregnb/mui-datatables/pull/1862

use‌‌‌‌ --force at the and:)

use npm install @mui/styles --save adding --save will help you

Try use the same version as the SandBox, https://codesandbox.io/s/muidatatables-custom-toolbar-rvmcj?file=/index.js, 3.4.1, for now to solve the problem