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

Viewed 5773

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?

3 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.

I had the same issue with the Skeleton component. I upgraded @material-ui/core to 4.12.1 and the error was resolved.

I had the same issue with Buttons, I upgraded my libraries to the next versions then run npm i, restart the server and it works.

@material-ui/core: "4.11.4"
@material-ui/lab: "4.0.0-alpha.58"
@material-ui/icons: "4.11.2"
@material-ui/pickers: "3.3.10"
Related