Home > Back-end >  MUI : Module not found "Module not found: Error: Can't resolve 'moment' "
MUI : Module not found "Module not found: Error: Can't resolve 'moment' "

Time:05-22

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?

CodePudding user response:

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

CodePudding user response:

You need to install moment hs module, please run

npm install moment

It should solve the problem. Also make sure to import them in the component where you are trying to use it.

  • Related