Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Error: Can't resolve '@mui/styles' #1854

Closed
kevintruo1 opened this issue Feb 8, 2022 · 18 comments
Closed

Module not found: Error: Can't resolve '@mui/styles' #1854

kevintruo1 opened this issue Feb 8, 2022 · 18 comments

Comments

@kevintruo1
Copy link

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
@mav2287
Copy link

mav2287 commented Feb 10, 2022

I am having the same issue. Installing "@mui/styles" will get the app to compile, but if you view a data-table it will crash the entire application.

This is what I have for dependencies:

    "@emotion/react": "^11.7.1",
    "@emotion/styled": "^11.6.0",
    "@material-ui/data-grid": "^4.0.0-alpha.37",
    "@material-ui/icons": "^4.11.2",
    "@mui/material": "^5.4.1",
    "@reduxjs/toolkit": "^1.7.2",
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^0.25.0",
    "base-shell": "^2.4.14",
    "fontsource-cinzel": "^4.0.0",
    "fontsource-montserrat": "^4.0.0",
    "mui-datatables": "^4.0.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-helmet": "^6.1.0",
    "react-intl": "^5.24.6",
    "react-redux": "^7.2.6",
    "react-router-dom": "^6.2.1",
    "react-scripts": "^5.0.0",
    "redux-thunk": "^2.4.1",
    "typescript": "^4.5.5"

Is there any fix?

@rafa-perroni00
Copy link

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

@TracesOfNuts
Copy link

I am having the same issue. Installing "@mui/styles" will get the app to compile, but if you view a data-table it will crash the entire application.

This is what I have for dependencies:

    "@emotion/react": "^11.7.1",
    "@emotion/styled": "^11.6.0",
    "@material-ui/data-grid": "^4.0.0-alpha.37",
    "@material-ui/icons": "^4.11.2",
    "@mui/material": "^5.4.1",
    "@reduxjs/toolkit": "^1.7.2",
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^0.25.0",
    "base-shell": "^2.4.14",
    "fontsource-cinzel": "^4.0.0",
    "fontsource-montserrat": "^4.0.0",
    "mui-datatables": "^4.0.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-helmet": "^6.1.0",
    "react-intl": "^5.24.6",
    "react-redux": "^7.2.6",
    "react-router-dom": "^6.2.1",
    "react-scripts": "^5.0.0",
    "redux-thunk": "^2.4.1",
    "typescript": "^4.5.5"

Is there any fix?

Having the same problem. Tried installing @mui/styles but the table will not show

@MichaelC753
Copy link

Hello, I'm having the same issue I can't compile with webpack.


"dependencies": {
    "@emotion/react": "^11.7.1",
    "@emotion/styled": "^11.6.0",
    "@fontsource/roboto": "^4.5.3",
    "@mui/icons-material": "^5.4.1",
    "@mui/lab": "^5.0.0-alpha.68",
    "@mui/material": "^5.4.1",
    "@mui/x-data-grid": "^5.5.1",
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^0.26.0",
    "convert-svg-react": "^1.0.0-beta.8",
    "history": "^5.2.0",
    "mui-datatables": "^4.0.0",
    "prop-types": "^15.8.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-json-view": "^1.21.3",
    "react-router-dom": "6.2.1",
    "react-scripts": "^5.0.0",
    "react-svgmt": "^1.2.0",
    "react-validation": "^3.0.7",
    "validator": "^13.7.0",
    "web-vitals": "^2.1.4"
  },

@mav2287
Copy link

mav2287 commented Feb 15, 2022

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

I tried 3.4.1 and it is working so the bug must have been introduced after that.

@kevintruo1
Copy link
Author

Can someone mark it as bug?

@Fullbusters
Copy link
Contributor

it`s bug because of this #1826

you must install also "@mui/styles" when used mui-datatables 4.0.0

@Fullbusters
Copy link
Contributor

@kevintruo hope that this PR will help with your issue #1862

@kevinntruo
Copy link

@Fullbusters thank you! Waiting for the PR approval :)

@Fullbusters
Copy link
Contributor

@kevinntruo @mav2287 @MichaelC753 please update mui-datatables to 4.1,0, this error should be resolved

@mav2287
Copy link

mav2287 commented Feb 20, 2022

Just installed 4.1.2 and I can confirm it has fixed my issue.

@kevinntruo
Copy link

Same here, 4.1.2 fixed my issue! Thank you @Fullbusters

@Mouma22
Copy link

Mouma22 commented May 30, 2022

how to install mui styles?
please help as I'm just a Beginner :)

@quyle92
Copy link

quyle92 commented Jun 24, 2022

how to install mui styles? please help as I'm just a Beginner :)

$ npm install @emotion/styled

@Jijo-John
Copy link

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

@sobhansharafi
Copy link

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

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

@slimmwillis
Copy link

potattoooo

@kemisstep
Copy link

same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests