Material-table: Failed to compile error when I try to import module

Created on 22 Feb 2019  路  8Comments  路  Source: mbrn/material-table

Describe the bug
I have tried to import the module and straight away get this error:

./node_modules/material-ui-pickers/utils/date-fns-utils/index.esm.js Module not found: Can't resolve 'date-fns/addDays' in '/Users/.../node_modules/material-ui-pickers/utils/date-fns-utils'

To Reproduce
Steps to reproduce the behavior:

  1. Intall material-table
  2. Import inside a react app (generated by create-react-app)
  3. View in browser

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser: chrome, safari
  • Version: 72.0.3626.109 (Official Build) (64-bit)
help wanted

Most helpful comment

I upgraded all date-fns and date picker dependencies. This should be resolved with v1.23.2

All 8 comments

I also am facing this issue, I believe it has to do with something regarding the renaming of date-fns'es folders from camelcase to dashed (addDays -> add-days). It doesn't make any sense to me because this library is locked to a certain version of date-fns, so I'm at a loss why this is happening.

I resolved this by manually adding material-table's [email protected] to my dependencies. I forgot to mention I'm using yarn workspaces in this project, but I feel it has to do with material-table and material-ui-pickers having different date-fns requirements and for some reason npm / yarn isn't handling this properly but that is as much as I can figure out.

I will try this case asap.

Ran into this exact same issue, including the fact that I'm using Yarn Workspaces. I'm using the following Material-UI dependencies, if it helps any:

    "@material-ui/core": "^3.9.2",
    "@material-ui/icons": "^3.0.2",

I was not able to resolve this by manually adding [email protected] to my repo, unfortunately.

Hi @cwbuecheler , @khwsab

Our project (https://github.com/Digiturk/wface) uses yarn workspaces and lerna too. components module dependent to material-table. And it has a dependency to [email protected]. So we don't have any problem with them. Can you check our project please?

I upgraded all date-fns and date picker dependencies. This should be resolved with v1.23.2

Hi. I have material-table 1.57.2 and material-ui/core 4.9.7 and I am experiencing the same problem. I tried to yarn add [email protected], and I got a new issue. I got the error message "Cannot find module '../locale/en-US/index.js' from 'index.js'". Is there a solution to this problem?

Also, I should point out that I am not using the material-ui/icons, I am using font-awesome instead. I got this working, but there is a failure on the unit test for Can't resolve 'date-fns/addDays', as described above. Do I have to install material-ui/icons?

Was this page helpful?
0 / 5 - 0 ratings