reactjsnpmmaterial-uinpm-installmui-x-date-picker

MUI : Module not found "Module not found: Error: Can't resolve 'moment' "


Getting multiple errors of this sort, while trying to use date-picker from mui-x.

Module not found: Error: Can't resolve 'moment'

Can't resolve '@mui/x-date-pickers/LocalizationProvider'

Module not found: Error: Can't resolve '../internals/hooks/useUtils'`

and many more. I have done npm install @mui/x-date-pickers

here is the usage:

<LocalizationProvider dateAdapter={AdapterMoment}>
      <DatePicker
        name="deadline"
        label="Deadline"
        renderInput={(params) => <TextField {...params} />}
      />
</LocalizationProvider>

What is going wrong and how do i fix this issue?


Solution

  • Seems like a peer dependency needed. npm install moment --save or yarn add moment will do