mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.74k stars 32.24k forks source link

Can't resolve '@mui/material/generateUtilityClass' #34912

Closed Gougerik closed 1 year ago

Gougerik commented 1 year ago

Untill now everything worked well. Today I updated packages and I got this error: _./nodemodules/@mui/lab/Masonry/masonryClasses.js:1:0 Module not found: Can't resolve '@mui/material/generateUtilityClass'

I'm using NextJS framework. This is my code:

import Masonry from '@mui/lab/Masonry';

// ...
<Masonry columns={{ xs: 1, sm: 2, md: 4 }} spacing={2}>
    {[...Array(31)].map((item: null, i: number) => (
         <img src={`/galeria/realizacie/${i}.jpg`} alt={String(i)} draggable={false} />
     ))}
</Masonry>
// ...
duylinhdang1998 commented 1 year ago

+1 here is my dependencies: "dependencies": { "@date-io/dayjs": "^2.11.0", "@emotion/react": "^11.7.0", "@emotion/styled": "^11.6.0", "@mui/icons-material": "^5.2.1", "@mui/lab": "^5.0.0-alpha.59", "@mui/material": "^5.2.2", "@mui/styles": "^5.2.2", "@mui/x-data-grid": "^5.1.0", "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "axios": "^0.24.0", "buffer-from": "^1.1.2", "crypto-js": "^4.1.1", "dayjs": "^1.10.7", "env-cmd": "^10.1.0", "lodash": "^4.17.21", "numeral": "^2.0.6", "qs": "^6.10.2", "react": "^17.0.2", "react-app-rewired": "^2.1.8", "react-dom": "^17.0.2", "react-hook-form": "^7.22.2", "react-query": "^3.34.5", "react-router-dom": "^6.0.2", "react-scripts": "4.0.3", "react-table": "^7.7.0", "react-use": "^17.3.1", "typedarray-to-buffer": "^4.0.0", "typescript": "^4.5.2", "uuid": "^8.3.2", "web-vitals": "^1.0.1" },

ccromnow commented 1 year ago

I think its due to them moving internal functions between packages around that are dependant on each other. check what version of @mui/base you get. all "base", "styles", "material" and systems" I think needs to be part of the same release to guarantee that it will work: https://github.com/mui/material-ui/releases

at least that solved the same error in our environment.

Gougerik commented 1 year ago

I think its due to them moving internal functions between packages around that are dependant on each other. check what version of @mui/base you get. all "base", "styles", "material" and systems" I think needs to be part of the same release to guarantee that it will work: https://github.com/mui/material-ui/releases

at least that solved the same error in our environment.

This is my dependency list: "dependencies": { "@emotion/cache": "latest", "@emotion/react": "latest", "@emotion/server": "latest", "@emotion/styled": "latest", "@fontsource/roboto": "^4.5.8", "@mui/icons-material": "latest", "@mui/lab": "^5.0.0-alpha.105", "@mui/material": "latest", "axios": "^1.1.3", "next": "latest", "nodemailer": "^6.8.0", "nookies": "^2.5.2", "react": "latest", "react-dom": "latest", "react-google-recaptcha-v3": "^1.10.0", "react-responsive-carousel": "^3.2.23", "sass": "^1.55.0" }

Tracer1337 commented 1 year ago

Upgrading @mui/material from 5.10.10 to 5.10.11 fixed the problem for me

Gougerik commented 1 year ago

Upgrading @mui/material from 5.10.10 to 5.10.11 fixed the problem for me

Yes... When I replaced "@mui/material": "latest" with "@mui/material": "^5.10.11", the issue went gone. Thanks for your note.

maima-online commented 1 year ago

Upgrading @mui/material to the lastest version works

Azizkhuja commented 1 year ago

As you @Tracer1337 wrote it is fixed my issue as well, thanks

MBeggiato commented 1 year ago

Upgrading @mui/material from 5.10.10 to 5.10.11 fixed the problem for me

Thank you so much!

ogutdgn commented 1 year ago

how can I update? I dont know how to.

Gougerik commented 1 year ago

how can I update? I dont know how to.

You can change a version in the package.json file and then use yarn on npm i. You can use npm-check-updates tho.