'Attempted import error: 'alpha' is not exported from '@material-ui/core/styles'

I'm trying to use the material-ui/lab date picker, however I'm getting this error! I have updated my material-ui version using npm install @material-ui/core@latest and it worked fine. However, I lost the ability to use createMuiTheme & MuiThemeProvider.



Solution 1:[1]

Maybe it'll be helpful for someone. For me fix of that issue was to change the indirect import to direct one:

so this triggered the error:

import { Alert } from '@material-ui/lab';

this works fine:

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

Solution 2:[2]

You should update your package.json with following:

"@material-ui/lab": "4.0.0-alpha.57",
"@material-ui/pickers": "3.2.10",

Solution 3:[3]

I had the same problem with Skeleton using version @material-ui/lab": "4.0.0-alpha.60 but changing it to version @material-ui/lab": "4.0.0-alpha.57 fixed it for me ... guess they broke it again :)

Solution 4:[4]

I had to downgrade npm [email protected] and npm install @material-ui/[email protected] then it fixed all issues. Please check node version with your node.

Solution 5:[5]

Please try updating to latest version of @material-ui/core. That should fix the issue.

Solution 6:[6]

My material-ui version when first downloaded was an earlier version. Then i ran:

npm i -g npm-check-updates
ncu -u
npm install

to let it upgrade automatically to latest version.

Solution 7:[7]

I was using MUI v4 and was trying to use the Appbar from MUI, updating my MUI by running the command npm install @material-ui/core@latest and restarting the server by using npm start worked for Me, Hope this helps!!

Solution 8:[8]

i can't solve this problem with above solutions.
so manually change 'alpha' to 'fade' in material ui files

./node_modules/@material_ui/lab/esm/

for example :

import { fade, withStyles, useTheme } from '@material-ui/core/styles';

instead

import { alpha, withStyles, useTheme } from '@material-ui/core/styles';

it's works for me
but it's not correct solutions.

Solution 9:[9]

update npm @material-ui/core package npm update resolved my issue

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ustin
Solution 2 Daniil Koziura
Solution 3 MakanMakan
Solution 4 Forhad
Solution 5 Etienne Kaiser
Solution 6 Sophie cai
Solution 7 IqraMalik21
Solution 8 adel parsa
Solution 9 Inshaf Ahmed