Reputation: 253
I am using react Material UI, and I received the following error.
"Module not found: Can't resolve '@material-ui/icons/Lock'"
import LockIcon from '@material-ui/icons/Lock';
How can I fix this?
Upvotes: 9
Views: 26918
Reputation: 1
This syntax worked for me in React import VolumeUp from '@mui/icons-material/VolumeUp'
and you must install npm i --save '@mui/icons-material'
You can find more info here and a React Code Generator here
Upvotes: 0
Reputation: 154
Here's an alternative is you cant install the node modules:
You can find more info about all the icons here
Upvotes: 0
Reputation: 1
MUI have since separated their icons
from core into a separate node_module called @material-ui/icons
.
Here's a good example on how to setup your MUI Icons with React: https://mechanicalrock.github.io/2021/04/27/fed-talk-s01e01-getting-started#keyboard-getting-started-with-material-ui
Upvotes: 0
Reputation: 393
import Icon from '@material-ui/core/Icon';
then add font material icons to index.html
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
Upvotes: 15
Reputation: 8122
You haven't installed @material-ui/icons
package. You can validate it from node_modules
This would resolve your issue,
npm install --save @material-ui/icons
Upvotes: 0