Module not found in mui-icons
Asked Answered
V

1

0

I'd resolve npm install error by forcing but now getting other error so posting this question.

  1. Issue resolve relate to npm install @mui/icons-material :- Error

  2. but now getting below error after running npm start

Failed to compile.

./node_modules/@mui/icons-material/Delete.js
Module not found: Can't resolve 'react/jsx-runtime'

but I had found 2 Delete.js files on above given path not sure why still getting this error.

I've checked the below pages

  1. https://mui.com/material-ui/icons/
  2. https://react.dev/blog/2022/03/08/react-18-upgrade-guide
Vindicate answered 18/7, 2023 at 8:37 Comment(0)
V
1

I tried multiple things. Hope my solution will come handy for you. Blog

Out of that 2 ans are very interesting.

  1. from Sibiraj - (This is risky solution as you have to delete node modules and package-lock files. As after deleting this files when I ran the npm install I got error. Since I had the copy I recovered this files.)

This feature has been introduced in npm v5. update to npm using npm install -g npm@latest and to update package.json

delete /node_modules and package-lock.json (if you have any)

run npm update. this will update the dependencies package.json to the latest.

to update to very latest version. you can go with npm-check-updates.

  1. From Andrei Gec (I did not tried this as I already went for option 1, but option 2 looks safe as it gives exact same file: I crossed checked)

If you're looking for an easier solution that doesn't involve installing npm packages, I'd checkout updatepackagejson.com

Solution to above problem run the below line of code. Link

npm install @mui/icons-material @mui/material @emotion/styled @emotion/react

I was getting error while running this in hyper as my package.json was not updated. And due package-lock even after running npm-check-updates package.json did not got updated.

Vindicate answered 18/7, 2023 at 10:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.