React-date-picker: Module not found

Created on 11 Sep 2018  路  8Comments  路  Source: wojtekmaj/react-date-picker

Hi @wojtekmaj I am having an issue with react-date-picker where it is unable to resolve the react-calendar module. I don't know why it is happening. This is the first time I am facing this kind of issue.
Here is the complete error report:
React: 15.6
react-date-picker: 6.7.0
Error reported by webpack:
ERROR in ./node_modules/react-date-picker/dist/shared/locales.js [0] Module not found: Error: Can't resolve 'react-calendar/dist/shared/locales' in '/home/modestreet/modestreet-repo/webUI/node_modules/react-date-picker/dist/shared' [0] @ ./node_modules/react-date-picker/dist/shared/locales.js 7:15-60 [0] @ ./node_modules/react-date-picker/dist/DateInput.js [0] @ ./node_modules/react-date-picker/dist/DatePicker.js [0] @ ./node_modules/react-date-picker/dist/entry.js [0] @ ./src/components/addEditInfo/AddEditInfo.js [0] @ ./src/components/setupModule/SetupModule.js [0] @ ./src/components/index.js [0] @ ./src/services/routes.js [0] @ ./src/components/modeStreetRouter/modeStreetRouter.js [0] @ ./src/app.js [0] @ ./index.js

I found a similar issue related to this but it was closed due to inactivity. Although I have commented there as well. See https://github.com/wojtekmaj/react-date-picker/issues/11#issuecomment-420168268. Feel free to close this incase you decided to reopen that one.
Thanks

question

Most helpful comment

You could add "react-calendar": "2.11.0" (mind the lack of ^) to your package.json and hopefully npm will dedupe it and won't install two versions of react-calendar.

All 8 comments

Hey there,
users stuck on older versions of React are using React-Date-Picker version which are also not supported well.

My official workaround would be to use Yarn selective dependency resolutions to force React-Calendar to be a fixed version of 2.11.0.

@wojtekmaj On further debugging I found that react-date-picker has a dev dependency on react-calendar but I don't know why it is not making its node_modules folder for that dependency and since my webpack might be configured to resolve dependency in that particular manner it is not able to find that

@wojtekmaj I don't want to annoy you but I don't want to install yarn for fixing this dependency resolution. Is there another work around :slightly_smiling_face:

You could add "react-calendar": "2.11.0" (mind the lack of ^) to your package.json and hopefully npm will dedupe it and won't install two versions of react-calendar.

@wojtekmaj thanks mate! :smile: You saved me a lot of time. Although I have some other calendar errors that might be because of invalid props I might be passing, but webpack has complied successfully. :+1:

Feel free to close this.

@wojtekmaj one more thing can you improve your library documentation a bit. Can you just add some more sample examples, that would help me a lot and I have starred your repos. too.

That's a great idea :) I'll add something like "Recipes" soon. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dozoisch picture dozoisch  路  4Comments

Omortis picture Omortis  路  4Comments

hyxos picture hyxos  路  4Comments

adityatandon007 picture adityatandon007  路  4Comments

allys00 picture allys00  路  4Comments