question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Can't resolve '@mui/styled-engine'

See original GitHub issue

Because of the hard github templates I almost forgot to say: Thank you so much for all the hard work on this library! I’m coming from a few different design-systems and I really love the components and api of mui! ❤️

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

After following the installation guide, when starting the app I’m getting following errors.

ERROR in ../../node_modules/@mui/system/esm/index.js 1:0-88
Module not found: Error: Can't resolve '@mui/styled-engine' in 'node_modules\@mui\system\esm'

I’m using styled-components but also tried temporarily adding emotion to my project which seems to work fine. I have followed the styled-engine-sc guide carefully but the error sticks around.

I’m using CRA with lerna and yarn workspaces. The styled-engine folder does appear in the root node_modules folder but for some reason, it can’t be resolved.

Also tried deleting all packages in node_modules and reinstalled multiple times.

Expected behavior 🤔

No errors

Steps to reproduce 🕹

Couldn’t find a way to reproduce this in a codesandbox yet but judging from the closed issues https://github.com/mui-org/material-ui/issues/28559 and https://github.com/mui-org/material-ui/issues/27846, some people that were commenting there were running into similar issues.

Your environment 🌎

`npx @mui/envinfo`
  System:
    OS: Windows 10 10.0.22000
    CPU: (12) x64 AMD Ryzen 5 5500U with Radeon Graphics
    Memory: 3.06 GB / 15.35 GB
  Binaries:
    Node: 16.8.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.21.0 - C:\Program Files\nodejs\npm.CMD
  Managers:
    pip3: 20.2.3 - C:\Python39\Scripts\pip3.EXE
  Utilities:
    Git: 2.31.1.
  SDKs:
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.17763.0
  IDEs:
    VSCode: 1.63.2 
  Languages:
    Python: 3.9.2
  Databases:
    PostgreSQL: 13.3 - C:\Program Files\PostgreSQL\13\bin\postgres.EXE
  Browsers:
    Chrome: 97.0.4692.71 
  Monorepos:
    Yarn Workspaces: 1.22.10
    Lerna: 4.0.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
boxi79commented, Oct 20, 2022

Do not do package.json dependencies resolutions step, or it will cause your content of ./node_modules/@mui/styled-engine to be styled-engine-sc package.

package.json

 {
   "dependencies": {
-    "@mui/styled-engine": "latest"
+    "@mui/styled-engine": "npm:@mui/styled-engine-sc@latest"
   },
+  "resolutions": {
+    "@mui/styled-engine": "npm:@mui/styled-engine-sc@latest"
+  },
 }

Just do webpack.config.js and tsconfig.json part.

0reactions
MaxiSantoscommented, Sep 14, 2022

https://github.com/mui/material-ui/issues/27846

This is still happening… wondering where the problem is…

Module not found: Can't resolve '@mui/styled-engine'

Import trace for requested module:
./node_modules/@mui/system/esm/ThemeProvider/index.js
./node_modules/@mui/system/esm/index.js

I have styled-engine folder under node_modules/@mui (and the engine is styled-compoennt-sr) I saw it working when changed styled-engine version to a different one (from 5.3.0 to latest) But after reinstalling all again (because I watend to see if it was working correctly) then it started to fail again

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Can't resolve '@mui/styled-engine' #30599 - GitHub
I'm using CRA with lerna and yarn workspaces. The styled-engine folder does appear in the root node_modules folder but for some reason, it...
Read more >
Module not found: Can't resolve '@mui/material' | bobbyhadz
To solve the error "Module not found: Error: Can't resolve '@mui/material'", make sure to install the package by opening your terminal in your...
Read more >
Module not found: Can't resolve '@emotion/react' in 'E ...
Module not found: Can't resolve '@emotion/react' in 'E:\frontend\node_modules\@mui\styled-engine' · 1. What are the contents of your package.json ...
Read more >
@mui/styled-engine - npm
styled () API wrapper package for emotion.. Latest version: 5.11.0, last published: 15 days ago. Start using @mui/styled-engine in your ...
Read more >
module not found: error: can't resolve '@mui/material/box'
Open the terminal and run the following command to save it in your dependencies object of package. json: :: npm command npm install...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found