Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix the error 'alpha' is not exported from '@material-ui/core/styles' when using Skeleton in Material UI

I am using Material UI and I am getting a nasty error on Ubuntu with the Skeleton component. While on Windows I do not get this error and everything works fine, on Ubuntu I am getting the following error:

./node_modules/@material-ui/lab/esm/Skeleton/Skeleton.js
Attempted import error: 'alpha' is not exported from '@material-ui/core/styles'.

The import is taken from the official docs:

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

On windows package.json my dependencies are these and all works fine:

"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2"

On Ubuntu it tells me that the lab is missing (and it is actually where the Skeleton should be, I do not know why on Windows it works despite not having the lab installed), so after I installed the lab the package.json on Ubuntu is this:

"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60"

And here is where I get the error I mentioned on the top.

Any idea why this happens?

like image 887
Andrea D_ Avatar asked Jul 13 '21 04:07

Andrea D_


1 Answers

It is because your @material-ui/lab is the latest version but the core is not the latest one. Upgrading @material-ui/core to 4.12.1 (or latest) version would solve this error.

like image 166
alisasani Avatar answered Sep 18 '22 23:09

alisasani