hypeserver / react-date-range

A React component for choosing dates and date ranges.
MIT License
2.59k stars 672 forks source link

Module not found: Can't resolve 'date-fns/locale/en-US' #352

Closed praneetha-ck-robo closed 4 years ago

praneetha-ck-robo commented 4 years ago

Subject of the issue

Failed to compile
./node_modules/react-date-range/dist/components/Calendar/index.js
Module not found: Can't resolve 'date-fns/locale/en-US' in '/Volumes/Development/NoonProjects/merchant-panel/frontend/node_modules/react-date-range/dist/components/Calendar'

[BUG] Bug Reproduce Steps

After running npm install and then running npm start, I get this error.

Environment

Package Version: "^1.0.3" React version: ""^16.13.0" Node version: v12.16.1 Browser: Chrome - Version 80.0.3987.132

onurkerimov commented 4 years ago

You need to install date-fns in your node_modules. As of the version 1.0.0, this module expects date-fns as a peerDependency. Just run npm install date-fns in your project folder and it should be OK.

You can use this sandbox as an example: https://codesandbox.io/s/react-date-range-example-bqksq