mui / material-ui

Material UI: Ready-to-use foundational React components, free forever. It includes Material UI, which implements Google's Material Design.
https://mui.com/material-ui/
MIT License
92.04k stars 31.64k forks source link

Module not found: Error: Can't resolve '@mui/material' #42182

Closed DBDev90 closed 3 weeks ago

DBDev90 commented 3 weeks ago

Steps to reproduce

No response

Current behavior

I created my project in REACT with Typescript. I organized the folders and also the dependencies. Soon after, I added the MUI library following the steps on the website https://mui.com/material-ui/getting-started/installation/ When adding a Button using the import "@mui/material" my project presents the error Module not found: Error: Can't resolve '@mui/material'

image image image

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: Module not found: Error: Can't resolve '@mui/material'

yamahmed commented 3 weeks ago

Hey there, did you check your tsconfig.json file ? sometimes you need to ensure that your tsconfig.json file is configured correctly to include MUI's module paths. You may need to add "node_modules/@mui" to the include array. let me know if that helps :)

brijeshb42 commented 3 weeks ago

A repo/codesandbox with the replication will be useful. We don't have any idea what build tools you are using. Maybe CRA because of react-scripts.

DBDev90 commented 3 weeks ago

I solved the problem by deleting the node_modules folder and also the yarn.lock file, then I installed the dependencies again with 'npm i'.

I appreciate the help.