Zekarias Taye Hirpo
Zekarias Taye Hirpo

Reputation: 847

Material ui icons

Problem description

I have a react-django app with material-ui. I used to import and material-ui icons without any problem. Today, I couldn't even build my app after importing a new icon from material-ui.

import WebIcon from '@mui/icons-material/Web';

This is the error message when I try to start my react app,

> react-scripts start
Starting the development server...
Failed to compile.

./node_modules/@mui/icons-material/utils/createSvgIcon.js
 Module not found: Can't resolve '@mui/material/utils' in 
'/home/ztaye/Documents/Work/Afropa/code/afropa/frontend/node_modules/@mui/icons- 
material/utils'
/home/ztaye/Documents/Work/Afropa/code/afropa/frontend/node_modules/react- 
scripts/scripts/start.js:19
throw err;
^

Error: ENOENT: no such file or directory, stat '/initrd.img'

Expectation

I just suspect the error is coming from their new updates. I have tried to re-install the package using this link, it didn't work.

Upvotes: 0

Views: 3856

Answers (2)

Zekarias Taye Hirpo
Zekarias Taye Hirpo

Reputation: 847

It's backward compatibility issue after an update from material-ui. It started to work after I replace all

@mui/icons-material/

to

@material-ui/icons/

On each icon imports.

Upvotes: 1

codmitu
codmitu

Reputation: 709

i dont know Django but in my React i import: import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';

if you install it like this: npm i @material-ui/icons

Upvotes: 0

Related Questions