Getting error deploying a react app in netlify

Hi Guys,

Getting error in when npm run build is run. This project is working fine in local. Please check.

Hi @fs-projects , welcome and thanks for posting.

Module not found: Error: Can’t resolve ‘@mui/material/ToolBar’ in "/opt/build/repo/src/components/Header*

Make sure you are importing the module like the below.

import Toolbar from '@mui/material/Toolbar';
// or
import { Toolbar } from '@mui/material';

Finally also make sure you have properly installed MUI by following the official MUI documentation below

Also checkout the answer below by @coelmay if you have used different package managers in your project.

Let me know if the suggestions above works or not.

thanks for your reply. I am using this syntax in my project.

import Toolbar from ‘@mui/material/Toolbar’;

You can refer to my repo : GitHub - fs-projects/travel-advisor-app: Website to display hotels, restaurants and attractions in your area.

I did check the supporting answer from @DennyAzevedo and I don’t have yarn in my project anywhere. npm run build works fine in my local but errors out in netlify container. Please let me know if you have any other advice. Thanks

1 Like

It’s supposed to be Toolbar and not ToolBar:


Thanks Man! It’s always the small things that matter in the end :slight_smile:

Thank you @hrishikesh