“Module not found: Can’t resolve ‘@material-ui/core/Container'”. This is a fairly common error that any programmer will make. So, what’s the source of this, and what can we do about it? Everything will be explained to you.
Why Did The Problem “Module not found: Can’t resolve ‘@material-ui/core/Container’” Happen?
You may get an error message in the browser.
Failed to compile Module not found: Can’t resolve ‘@material-ui/core/Container’
Instead of node modules, it looks for the component in your components directory. You cannot change directories into node modules../../ because node modules aren’t in the src directory, and the Create React App won’t let you.
You have removed yarn and added yarn to @material-ui/core. You tried yarn run build, but it returned an error.
Cannot find module: ‘@material-ui/core/Container’. Make sure this package is installed. You can install this package by running: yarn add @material-ui/core/Container.
You get the error when you try to add it.
error Couldn’t find package “@material-ui/core/Container” on the “npm” registry.
Here are the related dependencies you have:
"@material-ui/core": "^3.9.3", "@material-ui/icons": "^3.0.2", "react": "^16.8.6", "react-dom": "^16.8.6",
You expected to see the page’s contents not take up the entire screen width, but instead, you got a fail to compile error.
Simple Methods For You
The container is not a component of the material-ui version specified in your package. json. To upgrade, execute the following commands:
$ yarn add @material-ui/[email protected]
You may need to uninstall the previous stable version. As peer dependencies, React and react-dom >= 16.8.0 are all that is required, so the experimental upgrade material-ui should be sufficient to use the Container.
We can now assure you that your issue is easily solvable.
If you’re using npm, run this code:
npm install @material-ui/core
If you use cd new-app and yarn add @material-ui/core after a npx create-react-app new-app, it will compile with yarn start. You could try starting over.
This issue happens when you attempt to use the Material-UI component but fail to import it. Have you commented out all of the code to see if it compiles still?
Individual solutions provided here are the simplest for anyone experiencing “Module not found: Can’t resolve ‘@material-ui/core/Container'”.
If you still need help or have basic Reactjs concerns, you have a growing community where everyone is usually happy to help.
In addition, we anticipate a more creative day full of new ideas and code.