Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Can't resolve 'material-ui-icons/Menu' Martial Next #10571

Closed
liywjl opened this issue Mar 8, 2018 · 50 comments
Closed

Module not found: Can't resolve 'material-ui-icons/Menu' Martial Next #10571

liywjl opened this issue Mar 8, 2018 · 50 comments
Labels

Comments

@liywjl
Copy link

liywjl commented Mar 8, 2018

import MenuIcon from 'material-ui-icons/Menu';

causes

Module not found: Can't resolve 'material-ui-icons/Menu'

Used exact code from example: https://github.com/mui-org/material-ui/blob/v1-beta/docs/src/pages/demos/app-bar/ButtonAppBar.js

@liywjl
Copy link
Author

liywjl commented Mar 8, 2018

oh this is not part of the core material-ui package: npm install --save material-ui-icons

@liywjl liywjl closed this as completed Mar 8, 2018
@thewillwill
Copy link

thewillwill commented Apr 13, 2018

For anyone else experiencing this issue: npm install @material-ui/icons

https://www.npmjs.com/package/@material-ui/icons

@mbrookes
Copy link
Member

We'll probably add a deprecation warning to material-ui-icons at some point. For the moment they are functionally identical, but if Google ever release new icons, only @material-ui/icons will be updated.

@de24world
Copy link

de24world commented Sep 11, 2018

You should update @material-ui.
So please write in your terminal

npm install @material-ui/core
npm install @material-ui/icons

And restart 'npm start'

@danvc

This comment has been minimized.

@eps1lon

This comment has been minimized.

@danvc

This comment has been minimized.

@atulcodex
Copy link

have any idea about this error
Module not found: Can't resolve '@material-ui/core/Grid' in 'E:\Material Ui\firstapp\src'
:(

@eps1lon

This comment has been minimized.

@mbrookes

This comment has been minimized.

@mariacheline
Copy link

Hi, I get ....node_modules/@material-ui/icons"' has no exported member 'MenuIcon'.
despite installing @material-ui/icons

@zahidalidev
Copy link

i have the same issue just install
for icons
npm install @material-ui/icons

and for other materials
npm install @material-ui/core

and import like this
import AppBar from '@material-ui/core/AppBar';
import SearchIcon from '@material-ui/icons/Search';

@metalogica
Copy link

Would be nice to update the official docs to make this a little bit clearer.

@mbrookes
Copy link
Member

mbrookes commented May 6, 2020

@catonmat The first sentence in the Material Icons page mentions the package name. It's also covered in the Installation docs. Every example that uses icons shows the import, and there's a copyable import on each icon preview:

image

What do suggest we could do to make it clearer?

@Naim-Qawasmeh

This comment has been minimized.

@cooskun

This comment has been minimized.

@adisher
Copy link

adisher commented Jun 21, 2020

I was facing an issue, tried to import the icon automatically in vscode, but it was not working. Turned out, I had to import it in a separate way like: import DeleteIcon from '@material-ui/icons/Delete';

So, you see, DeleteIcon and Delete are two different names here.

@mbrookes
Copy link
Member

@adisher You can import it as Delete if you prefer, but importing as DeleteIcon is clearer when the component is used later.

@raychunghk
Copy link

Change
import MenuIcon from '@material-ui/icons/Menu';

to:
import Menu from '@material-ui/icons/Menu';

@tdecker91
Copy link

I was experiencing this issue because I was importing incorrectly. I was trying to use

import { MenuIcon } from '@material-ui/icons/Menu'

But I needed to change it to

import MenuIcon from '@material-ui/icons/Menu'

@akopchinskiy
Copy link

For anyone else experiencing this issue: npm install @material-ui/icons

https://www.npmjs.com/package/@material-ui/icons

Does. Not. Help.

@DHBuild002
Copy link

Using VS Code
I have both Icons and Core installed.
The SearchIcon is returning a similar error:

**Failed to Compile
Module not found: '@material-ui/icons/Search' in [Project Filepath]

@ ./src/Header.js 14:14-50**

This is the import instruction:
import SearchIcon from "@material-ui/icons/Search";

HTML:

Dependencies:

"@material-ui/core": "^4.11.0",
"material-ui-icons": "^1.0.0-beta.36",

@arpan-banerjee7
Copy link

You should update @material-ui.
So please write in your terminal

npm install @material-ui/core
npm install @material-ui/icons

And restart 'npm start'

It works!

@DHBuild002
Copy link

You should update @material-ui.
So please write in your terminal

npm install @material-ui/core
npm install @material-ui/icons

And restart 'npm start'

It works!

Yes, I found this package, suggested in another thread, was incorrect for my purpose:

"material-ui-icons": "^1.0.0-beta.36",

I reinstalled using your approach and found that resolved the problem. Thanks Arpan!

@lopeselio
Copy link

Use npm and not yarn. I had issues with yarn

@abelamelo
Copy link

Change
import MenuIcon from '@material-ui/icons/Menu';

to:
import { Menu as MenuIcon } from "@material-ui/icons";

@Prawinpravs
Copy link

For anyone else experiencing this issue: npm install @material-ui/icons

https://www.npmjs.com/package/@material-ui/icons

Hi even after installing this also i'm getting same error saying that
Module not found: Can't resolve '@material-ui/icons/Home' in 'C:\Users\User\Desktop\malnadmusic\src'

@matveychuk
Copy link

Use npm and not yarn. I had issues with yarn

It solved my issue. With yarn not all icons were in node_modules/@material-ui/icons. They start with 'R' letter don't know why. But after using 'npm i' all icons are in place

@harounchebbi
Copy link

Change
import MenuIcon from '@material-ui/icons/Menu';

to:
import { Menu as MenuIcon } from "@material-ui/icons";

This worked for me! thank youuu :))

@marafee1243
Copy link

Change
import MenuIcon from '@material-ui/icons/Menu';

to:
import Menu from '@material-ui/icons/Menu';

This worked perfect.

@dkm94
Copy link

dkm94 commented Sep 17, 2021

Change
import MenuIcon from '@material-ui/icons/Menu';

to:
import { Menu as MenuIcon } from "@material-ui/icons";

It worked for me thank you so much

@anubhavbagri
Copy link

anubhavbagri commented Sep 29, 2021

Change
import MenuIcon from '@material-ui/icons/Menu';

to:
import { Menu as MenuIcon } from "@material-ui/icons";

Perfect solution!

@rbabalola
Copy link

rbabalola commented Oct 9, 2021

This worked for me:

change
import DeleteIcon from '@mui/icons-material/Delete';

to
import DeleteIcon from '@material-ui/icons/Delete';

Seems there are bugs on the Icon path

@RandyWritesCode
Copy link

This worked for me:

change import DeleteIcon from '@mui/icons-material/Delete';

to import DeleteIcon from '@material-ui/icons/Delete';

Seems there are bugs on the Icon path

Made it all the way to the bottom to find this! Thanks for the post
(it worked)

@KDDeveloper
Copy link

Change import MenuIcon from '@material-ui/icons/Menu';

to: import { Menu as MenuIcon } from "@material-ui/icons";

Thankyou this worked!

@RandyWritesCode
Copy link

The path for an Icon was not correct. If the Module is not found, and you have imported the module, then maybe the path is not correct. Went to node_modules > @material-ui and scrolled until i found the file that I was looking for ie Help.js and used that in the import:

import HelpIcon from '@material-ui/icons/Help';

@PradipGohil
Copy link

npm install @mui/icons-material

@wdev0901
Copy link

This is worked me. Thank you.

@icest99
Copy link

icest99 commented Nov 27, 2021

For anyone else experiencing this issue: npm install @material-ui/icons
https://www.npmjs.com/package/@material-ui/icons

Hi even after installing this also i'm getting same error saying that Module not found: Can't resolve '@material-ui/icons/Home' in 'C:\Users\User\Desktop\malnadmusic\src'

Try to update your import style directly from MaterialUI Icon page

@Maclenn77
Copy link

Hi.

I experienced the same problems and I tried unsuccessfully many of the solutions here. After reading this post of StackOverflow, I realized the problem. My version is v4 and I was trying to import it as v5. Even when I reinstalled the material icons as appears in this thread, the version was the same.

So, if the solutions here don't work for you, I suggest checking your package.json file and checking the version. Here you can browse for icons of v4.

@AlbertDev33
Copy link

Use npm and not yarn. I had issues with yarn

Thanks. This worked for me! 👍

@WNortier
Copy link

WNortier commented Jun 9, 2022

After you've installed the packages in some cases you may need to restart the development server by quitting and running yarn start

@senior-dev-1019
Copy link

please install the icons-material like following command line
npm install @mui/icons-material

@aknahin
Copy link

aknahin commented Jul 14, 2022

Getting the same error. When I tried to install it with the code given above, these error message is shown.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree 
npm ERR!
npm ERR! While resolving: my-portfolio@0.1.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"^18.2.0" from the root project    
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR!   peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
npm ERR!   node_modules/@material-ui/icons
npm ERR!     @material-ui/icons@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Lenovo\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\Lenovo\AppData\Local\npm-cache\_logs\2022-07-14T08_06_45_166Z-debug-0.log

@aknahin
Copy link

aknahin commented Jul 14, 2022

Getting the same error. When I tried to install it with the code given above, these error message is shown.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree 
npm ERR!
npm ERR! While resolving: my-portfolio@0.1.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"^18.2.0" from the root project    
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR!   peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
npm ERR!   node_modules/@material-ui/icons
npm ERR!     @material-ui/icons@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Lenovo\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\Lenovo\AppData\Local\npm-cache\_logs\2022-07-14T08_06_45_166Z-debug-0.log

This code works for me: yarn add @material-ui/icons

@Tejv1708
Copy link

Tejv1708 commented Sep 9, 2022

Module not found: Error: Can't resolve '@material-ui/icons/LockOutlinedIcon' in .
What should I do .

@AlbertDev33
Copy link

Module not found: Error: Can't resolve '@material-ui/icons/LockOutlinedIcon' in . What should I do .

try: npm install @mui/icons-material

This worked for me.

@MichaelGorski
Copy link

Module not found: Error: Can't resolve '@material-ui/icons/LockOutlinedIcon' in . What should I do .

Did you try to use import { LockOutlined } from "@mui/icons-material"; ? I had the same issue with trying to import icons like import DeleteIcon from "@mui/icons-material/Delete"; but didnt work.
Using the other way solved it for me.

(using vite)

@RubenMoraVargas
Copy link

I fix this problem installing the correct library in my case
npm i @mui/icons-material
yarn add @mui/icons-material

@maniutin
Copy link

maniutin commented Dec 7, 2022

Hi.

I experienced the same problems and I tried unsuccessfully many of the solutions here. After reading this post of StackOverflow, I realized the problem. My version is v4 and I was trying to import it as v5. Even when I reinstalled the material icons as appears in this thread, the version was the same.

So, if the solutions here don't work for you, I suggest checking your package.json file and checking the version. Here you can browse for icons of v4.

this worked for me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests