Ranco
Ranco

Reputation: 21

How to install missing material-ui files in react

After having installed my material-ui for my react project, but when it comes to use it always bring up an error telling me that

'Module not found'

./src/Components/LatestPost.jsModule not found: Can't resolve@material-ui/lab/Skeleton' in 'C:\Users\Zinox\super-surf\src\Components'

Upvotes: 1

Views: 3619

Answers (4)

Ali Raza
Ali Raza

Reputation: 1

Module not found: Can't resolve '@material-ui/lab/Skeleton'

If you want to use Skeleton, Rating, Speed Dial, and so on you need to also install the Material UI Lab package.

npm install @material-ui/lab

or

yarn add @material-ui/lab

Link here. enter link description here

Upvotes: 0

Tonait Weburn
Tonait Weburn

Reputation: 1

Stumbled upon the same issue. Skeleton doesn't seem to be contained in the latest package version (4.0.0-alpha.22) at the moment. But it is on their source folder, which is odd.

Maybe you open an issue at their GitHub.

EDIT: I did: https://github.com/mui-org/material-ui/issues/16919

Upvotes: 0

Ramaraja
Ramaraja

Reputation: 2626

You would have only installed @material-ui/core package which would not include the experimental features you are looking for and hence you are getting the error Module not found: Can't resolve '@material-ui/lab/Skeleton'

To use experimental features of Material UI like Skeleton, Rating, Speed Dial and so on you need to also install the Material UI Lab package,

npm install @material-ui/lab

Note that this is needed in addition to the @material-ui/core package that you installed earlier with npm install @material-ui/core

After installing the above package you could import it as,

import Skeleton from '@material-ui/lab/Skeleton';

in your React Component and use it as desired.

Upvotes: 7

Mohammed Al-Reai
Mohammed Al-Reai

Reputation: 2806

you should add two packages into the app first is yAR i @material-ui/lab @material-ui/core

Upvotes: 0

Related Questions