Can't resolve '@material-ui/lab/AdapterDateFns'
Can't resolve '@material-ui/lab/DateTimePicker'
Can't resolve '@material-ui/lab/LocalizationProvider'
I am getting these errors even after having installed @material-ui/lab
I think that @material-ui/lab/AdapterDateFns will be supported with the date-fns library. I read it at mui documentation for React Date Picker.
@material-ui/pickers was moved to the @mui/lab. ⚠️ The date picker components were rewritten. In most places, the logic was rewritten from scratch, so it isn't possible to maintain the whole list of changes. Here's an overview of the most important concepts that were changed.
Try running npm install @material-ui/core@next and npm install @material-ui/lab@next This should move you to version 5. If the need arises, delete the node_modules folder and run npm install. Now if you look into the lab folder in node_modules/@material-ui, you will see the Show activity on this post. Show activity on this post.
Now if you look into the lab folder in node_modules/@material-ui, you will see the Show activity on this post. Show activity on this post. Make sure that you installed a date management library. I think that @material-ui/lab/AdapterDateFns will be supported with the date-fns library.
This works for me very well
npm install @mui/lab
In Material UI v5 you need to install @mui/lab.My dependencies are here :
"dependencies": {
"@mui/lab": "^5.0.0-alpha.54",
"@mui/material": "^5.2.1",
}
For more information check this link
I have a working codesandbox here: https://codesandbox.io/s/youthful-wave-8xjy4
Make sure both @material-ui/core
and @material-ui/lab
are at version "5.0.0-alpha.24"
or above as I ran into the same import errors as you when following the guide at: https://next.material-ui.com/guides/pickers-migration/
// package.json
{
"dependencies": {
"@emotion/react": "11.1.5",
"@emotion/styled": "11.1.5",
"@material-ui/core": "5.0.0-alpha.24",
"@material-ui/lab": "5.0.0-alpha.24",
"date-fns": "2.17.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-scripts": "4.0.0"
},
}
Try running npm install @material-ui/core@next
and npm install @material-ui/lab@next
This should move you to version 5.
If the need arises, delete the node_modules
folder and run npm install
.
Now if you look into the lab
folder in node_modules/@material-ui, you will see the
Make sure that you installed a date management library. I think that @material-ui/lab/AdapterDateFns
will be supported with the date-fns library.
date-fns installation
I read it at mui documentation for React Date Picker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With