vascofg / react-admin-date-inputs

Date Inputs for react-admin
MIT License
68 stars 81 forks source link

Can't resolve 'material-ui-pickers/utils/MuiPickersUtilsProvider' #15

Closed petersg83 closed 5 years ago

petersg83 commented 5 years ago

Hello,

I installed react-admin-dateinputs and I'm trying to use TimeInput but I have this error: Module not found: Can't resolve 'material-ui-pickers/utils/MuiPickersUtilsProvider' in '/Users/pierre/Documents/schoolx/frontend/node_modules/react-admin-date-inputs/lib'

Here is my package.json:

{ "name": "schoolx-frontend", "version": "0.1.0", "private": true, "dependencies": { "import": "^0.0.6", "jsonwebtoken": "^8.3.0", "moment": "^2.22.2", "ra-data-json-server": "^2.2.0", "ra-language-english": "^2.2.0", "ra-language-french": "^2.2.0", "react": "^16.4.2", "react-admin": "^2.4.0", "react-admin-date-inputs": "^1.1.0", "react-big-calendar": "^0.20.1", "react-dom": "^16.4.2", "react-router-dom": "^4.3.1", "react-scripts": "1.1.4", "recompose": "^0.28.2" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" } }

I tried to install the module material-ui-pickers but it didn't change anything.

Do you have an idea of how I can make it work ? Thanks :)

tmcgee commented 5 years ago

I am experiencing this as well. Likely related to the breaking changed noted in the material-ui-pickers version 1.0.0 release notes:

-import MuiPickersUtilsProvider from 'material-ui-pickers/utils/MuiPickersUtilsProvider'
+import MuiPickersUtilsProvider from 'material-ui-pickers/MuiPickersUtilsProvider'
stephme commented 5 years ago

https://github.com/vascofg/react-admin-date-inputs/pull/16 It worked for me. Thx @tmcgee

kent10ou commented 5 years ago

Thanks! I think this is a similar issue, is this change published to npm yet? Which version of material-ui is everyone else using?

./node_modules/material-ui-pickers/utils/date-fns-utils/index.esm.js
Module not found: Can't resolve 'date-fns/addDays' in '~/Documents/<project>/node_modules/material-ui-pickers/utils/date-fns-utils'
tmcgee commented 5 years ago

@kent10ou

This might be related to yet-another-release of material-ui-pickers. Version 2.0.0 this time. From the release notes:

We have moved our utils to the separate monorepo (star it here) and for now do

-import Utils from 'material-ui-pickers/utils/date-fns-utils'
+import Utils from '@date-io/date-fns'

Here is where I think the change should occur. I haven't had the opportunity to verify/fix locally.

Hope this helps.

romainquellec commented 5 years ago

@vascofg : Any plan to release a new version on npm ?

marquesgabriel commented 5 years ago

watching this thread

vascofg commented 5 years ago

Working on it now

vascofg commented 5 years ago

@kent10ou

This might be related to yet-another-release of material-ui-pickers. Version 2.0.0 this time. From the release notes:

We have moved our utils to the separate monorepo (star it here) and for now do

-import Utils from 'material-ui-pickers/utils/date-fns-utils'
+import Utils from '@date-io/date-fns'

Here is where I think the change should occur. I haven't had the opportunity to verify/fix locally.

Hope this helps.

Hey, unfortunately I won't be able to update to material-ui-pickers stable version since they decided to update to @material-ui/core@^3.2.0 and react-admin is still on @^1.4.0. This is causing some issues with the date-picker modal.

I'll try to publish a fixed version using the latest compatible material-ui-pickers version ASAP.

vascofg commented 5 years ago

Fixed in 1.0.21

astnerdev commented 5 years ago

Hey @vascofg, I have the same error message, but it's not solved in 1.0.21.

  "dependencies": {
    "@material-ui/core": "^3.2.0",
    "jwt-decode": "^2.2.0",
    "material-ui-chip-input": "^0.19.0",
    "ra-data-json-server": "^2.5.2",
    "ra-data-simple-rest": "^2.5.2",
    "react": "^16.7.0",
    "react-admin": "^2.4.0",
    "react-admin-date-inputs": "^1.0.21",
    "react-dom": "^16.7.0",
    "react-scripts": "2.1.2"
  }

Is the version 1.0.21 compatible with the current version of @material-ui/core 3.2.0 ? Thanks

charlesastaylor commented 5 years ago

I'm getting very similar error message:

./node_modules/material-ui-pickers/utils/date-fns-utils.js`
`Module not found: Can't resolve 'date-fns/addDays' in '<project_dir>/node_modules/material-ui-pickers/utils'

with

"dependencies": {
    "ra-data-simple-rest": "^2.5.3",
    "react": "^16.7.0",
    "react-admin": "^2.5.3",
    "react-admin-date-inputs": "^1.0.21",
    "react-dom": "^16.7.0",
    "react-scripts": "2.1.3"
  }
jacklj commented 5 years ago

I'm getting the error too:

Module not found: Error: Can't resolve 'date-fns/addDays' in '/tmp/build_768d2570a4572a43a5b79af1cef23b51/admin/node_modules/material-ui-pickers/utils'

Upgrading to 1.0.21 didn't help.

Installing date-fns v2.0.0-alpha.7 manually did allow the app to build, but then I get weird visual bugs in the date picker, presumably due to breaking changes in version 2 of date-fns.

despatates commented 4 years ago

It seems error Can't resolve 'material-ui-pickers/utils/MuiPickersUtilsProvider' is back. May it be linked to the upgrade of material-ui-pickers in PR #31?

despatates commented 4 years ago

An issue is open for this problem, see https://github.com/vascofg/react-admin-date-inputs/issues/37.

x5engine commented 4 years ago

anyway since the author is not here, here is a fix deployed to npm

https://github.com/x5engine/react-admin-date-inputs

npm install react-admin-date-inputs2 --save

Julien-Sytadelle commented 4 years ago

Just in case : If you still use react-admin v2.9, simply use the version 1.1.2 code you can easily find in commit history (1 file) and change the pickers import: import { MuiPickersUtilsProvider, DatePicker, TimePicker, DateTimePicker } from 'material-ui-pickers'; / import DatePicker from 'material-ui-pickers'; import TimePicker from 'material-ui-pickers'; import DateTimePicker from 'material-ui-pickers'; /