Open giorgiPapava opened 2 years ago
I was able to reproduce the error locally. @mnajdova would you mind taking a look. It may be easier for you to spot if there's a config error.
Before spending some much time on this, please we aware that currently there are problems with using @mui/styled-engine-sc
with next.js, see https://github.com/mui/material-ui/issues/29742
I could fix the problem locally by removing @mui/styled-engine
in the package.json. This is the diff:
index f698e0f..ec8384a 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,6 @@
},
"dependencies": {
"@mui/material": "^5.2.8",
- "@mui/styled-engine": "npm:@mui/styled-engine-sc@^5.1.0",
"@mui/styled-engine-sc": "^5.1.0",
"next": "12.0.7",
"react": "17.0.2",
Has this been addressed? Still experiencing it
Duplicates
Latest version
Current behavior ๐ฏ
I have production application on next.js, MUI and styled components. I had issue of styles flickering on first load. As I found out it was due to MUI using emotion internally and I was using styled-components to override styles. So, I switched to styled-engine-sc
Module not found: Can't resolve '@mui/styled-engine'
when trying to run dev server. I had 2 possible solutions: to remove yarn.lock file and go and reinstall yarn or manually install @mui/styled-engine-sc. Neither of those options are okay to me. Deleting yarn.lock file only temporarily solves the issue, after I add new library or remove node_modules and reinstall packages it does not seem to work.The problem comes from node_modules/@mui not containing styled-engine-sc folder inside.
Expected behavior ๐ค
It's expected to use styled-engine-sc without any problems
Steps to reproduce ๐น
I can't give you my repo since it's production application but you can try cloning this repo. The first time you do yarn everything works fine, but after you delete node_modules and run
yarn
the application breaks.Context ๐ฆ
next.config.js
package.json
_document.tsx
Your environment ๐
`npx @mui/envinfo`
``` System: OS: macOS 12.4 Binaries: Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node Yarn: 1.22.18 - ~/.nvm/versions/node/v16.14.2/bin/yarn npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm Browsers: Chrome: 102.0.5005.61 Edge: Not Found Firefox: 101.0.1 Safari: 15.5 npmPackages: @emotion/react: 11.9.3 @mui/icons-material: ^5.8.3 => 5.8.3 @mui/lab: ^5.0.0-alpha.85 => 5.0.0-alpha.85 @mui/material: ^5.8.3 => 5.8.3 @mui/styled-engine-sc: latest => 5.8.0 @mui/styles: ^5.8.3 => 5.8.3 @mui/system: ^5.8.3 => 5.8.3 @mui/utils: 5.8.0 @mui/x-date-pickers: 5.0.0-alpha.1 @types/react: ^17.0.2 => 17.0.45 react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 styled-components: ^5.3.3 => 5.3.5 typescript: ^4.4.3 => 4.7.3 ```