onefinestay / react-daterange-picker

Other
563 stars 209 forks source link

moment-range dependency still not fixed - Error: Can't resolve 'moment-range' #202

Closed hussaintamboli closed 5 years ago

hussaintamboli commented 5 years ago

I followed the exact same installation and usage instructions from README.

# installation
npm install react-daterange-picker --save
# this installed "react-daterange-picker": "^2.0.1",

# usage
import DateRangePicker from 'react-daterange-picker';
import 'react-daterange-picker/dist/css/react-calendar.css';
...

But when I run my app, I get this dependency error -

ERROR in ./node_modules/react-daterange-picker/dist/moment-range.js
Module not found: Error: Can't resolve 'moment-range' in '/Users/hussain/react-frontend/node_modules/react-daterange-picker/dist'
 @ ./node_modules/react-daterange-picker/dist/moment-range.js 11:19-42
 @ ./node_modules/react-daterange-picker/dist/DateRangePicker.js
 @ ./src/App.js

I found many similar issues in this project. But most of them are closed saying it's fixed in the latest version (probably in v2.0.0). But looks like it's not fixed because I am using v2.0.1.

AlanFoster commented 5 years ago

Out of interest, what version of npm and node do currently have installed?

hussaintamboli commented 5 years ago
node v9.3.0
npm v6.0.1
AlanFoster commented 5 years ago

@hussaintamboli If you install the moment-range dependency directly, I assume this resolves the issue for you?

hussaintamboli commented 5 years ago

Yes. that fixes the issue.

hussaintamboli commented 5 years ago

Also, I just noticed npm gives warning for installing moment-range when you install react-daterange-picker

$ npm install react-daterange-picker --save
npm WARN react-daterange-picker@2.0.1 requires a peer of moment-range@^3.0.3 but none is installed. You must install peer dependencies yourself.
george-norris-salesforce commented 4 years ago

If moment-range is a peer dep, it'll help if it was mentioned in the readme