'Installed mui with styled-engine but it's asking for emotion
I tried installing Material UI (mui), and followed the instructions in their guide for if you're using styled components:
npm install @mui/material @mui/styled-engine-sc
When I import a component into a file, I get the error
Module not found: Can't resolve '@emotion/react' in '(...my path...)/node_modules/@mui/styled-engine'
node_modules/@mui/styled-engine/index.js
Why is it looking for emotion when I followed the directions for using styled-components??
The full directions actually say
npm install @mui/material @mui/styled-engine-sc styled-components
But of course we're already using styled components. I tried this anyway, same problem.
Now the truth is that we're actually using React 16.4, and MUI requires React 17. I installed with --legacy-peer-deps. It doesn't seem, though, like the error I'm getting should have to do with the version of React I'm using?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
