Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module not found: Can't resolve '@material-ui/core/AppBar'

EDIT: Just discovered that not one single module installed through npm install --save can be resolved. The issue seems to be therefore with all modules even though they are located inside node_modules folder.

I have been debugging this error for the last 2 hours. Note that the application has been created with create-react-app tool.

This is how I am importing the module:

import AppBar from "@material-ui/core/AppBar";
import Button from "@material-ui/core/Button";
import Icon from "@material-ui/core/Icon";
import IconButton from "@material-ui/core/IconButton";
import Tabs from "@material-ui/core/Tabs";
import Tab from "@material-ui/core/Tab";

This is the package.json snippet:

...
"dependencies": {
    "@material-ui/core": "^1.5.1",
    "@material-ui/icons": "^1.1.1",
...
like image 916
James Avatar asked Aug 27 '18 15:08

James


People also ask

Can't resolve '@ MUI icons material cancel?

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 project's root directory and running the command npm i @mui/material @emotion/react @emotion/styled and restart your development server.


3 Answers

The solution that worked for me is the following:

npm install  @material-ui/core

Check the link https://www.npmjs.com/package/@material-ui/core

like image 176
Jorge Santos Neill Avatar answered Sep 21 '22 13:09

Jorge Santos Neill


Try - yarn add @material-ui/core

This resolved the broken dependencies between materialui and react. Worked for me in my case, it was @material-ui/core/chippedInput that was missing.

like image 31
Magnus Melwin Avatar answered Sep 20 '22 13:09

Magnus Melwin


In my case I was following a tutorial and ended up with an import as

import AppBar from 'material-ui/AppBar';

Instead of using the following which is in documentation here.

import AppBar from '@material-ui/core/AppBar';
// or
import { AppBar } from '@material-ui/core';
like image 38
tmndungu Avatar answered Sep 22 '22 13:09

tmndungu