Module not found: 'cldr' in ... \ globalize \ dist \ globalize

In my React application, I am trying to use the component DateTimePickerincluded in the package react-widgets. I also use Bootstrap 4 components through reactstrap.

I installed the modules:

npm install --save bootstrap@4.0.0-beta reactstrap@next
npm install --save globalize react-widgets-globalize

but when I try to use the component DateTimePicker:

import Globalize from 'globalize'
import globalizeLocalizer from 'react-widgets-globalize'
import { DateTimePicker } from 'react-widgets'

class Foo extends Component {
    render() {

        Globalize.locale('en')
        globalizeLocalizer()
        let formatter = Globalize.dateFormatter({ raw: 'MMM dd, yyyy' })

        return(
            <div>
                <DateTimePicker
                    format={formatter} 
                    defaultValue={new Date()}
                    time={false}
                />
            </div>
        )
    }
}

I get errors

Error in ./~/globalize/dist/globalize.js
Module not found: 'cldr' in C:\Users\y\Desktop\test\node_modules\globalize\dist
 @ ./~/globalize/dist/globalize.js 22:2-25:14

Error in ./~/globalize/dist/globalize.js
Module not found: 'cldr/event' in C:\Users\y\Desktop\test\node_modules\globalize\dist

 @ ./~/globalize/dist/globalize.js 22:2-25:14

Error in ./~/globalize/dist/globalize/message.js
Module not found: 'cldr' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/message.js 22:2-26:14

Error in ./~/globalize/dist/globalize/message.js
Module not found: 'cldr/event' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/message.js 22:2-26:14

Error in ./~/globalize/dist/globalize/number.js
Module not found: 'cldr' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/number.js 22:2-27:14

Error in ./~/globalize/dist/globalize/number.js
Module not found: 'cldr/event' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/number.js 22:2-27:14

Error in ./~/globalize/dist/globalize/number.js
Module not found: 'cldr/supplemental' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/number.js 22:2-27:14

Error in ./~/globalize/dist/globalize/plural.js
Module not found: 'cldr' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/plural.js 22:2-27:14

Error in ./~/globalize/dist/globalize/plural.js
Module not found: 'cldr/event' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/plural.js 22:2-27:14

Error in ./~/globalize/dist/globalize/plural.js
Module not found: 'cldr/supplemental' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/plural.js 22:2-27:14

Error in ./~/globalize/dist/globalize/currency.js
Module not found: 'cldr' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/currency.js 18:2-24:14

Error in ./~/globalize/dist/globalize/currency.js
Module not found: 'cldr/event' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/currency.js 18:2-24:14

Error in ./~/globalize/dist/globalize/currency.js
Module not found: 'cldr/supplemental' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/currency.js 18:2-24:14

Error in ./~/globalize/dist/globalize/date.js
Module not found: 'cldr' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/date.js 22:2-28:14

Error in ./~/globalize/dist/globalize/date.js
Module not found: 'cldr/event' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/date.js 22:2-28:14

Error in ./~/globalize/dist/globalize/date.js
Module not found: 'cldr/supplemental' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/date.js 22:2-28:14

Error in ./~/globalize/dist/globalize/relative-time.js
Module not found: 'cldr' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/relative-time.js 22:2-29:14

Error in ./~/globalize/dist/globalize/relative-time.js
Module not found: 'cldr/event' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/relative-time.js 22:2-29:14

Error in ./~/globalize/dist/globalize/relative-time.js
Module not found: 'cldr/supplemental' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/relative-time.js 22:2-29:14

Error in ./~/globalize/dist/globalize/unit.js
Module not found: 'cldr' in C:\Users\y\Desktop\test\node_modules\globalize\dist\globalize

 @ ./~/globalize/dist/globalize/unit.js 22:2-27:14

What packages or npm configuration are I still missing?

+8
source share
1 answer

try: npm i globalize I encountered the same problem in angular and this solution works for me after checking the document https://github.com/globalizejs/globalize

0
source

Source: https://habr.com/ru/post/1689215/


All Articles