Module not found: Can't resolve '@mui/lab/AdapterDateFns'

Viewed 24107

I was using the Material UI Timepicker but after updating to MUI 5 it is not working anymore. I updated everything to @next and @material-ui/core (version 5.0.0-beta.5) and @material-ui/lab (version: 5.0.0-alpha.44).

5 Answers

If you copy the Timepicker code from the MUI docs, you also need to install the lab package which contains the adapter code to integrate with date-fns. See the requirements here. For reference, you can see the package.json file from the live demo.

npm i @mui/lab

I had the same issue. What I did was installing date-fns as well

  npm i date-fns

I then stopped the localhost server and restart it again with npm start (I was using react)

npm start

sometimes it just needs this :

yarn add @mui/lab

install both npm i @mui/lab and npm i @mui/material

If after installing @mui/lab it doesn't work, You can add:

npm i @mui/material

Or

yarn add @mui/material
Related