Skip to content

Cannot resolve module 'react-intl/locale-data/ru' #203

Closed

Description

@catamphetamine

Webpack cannot resolve any locale-data

Module not found: Error: Cannot resolve module 'react-intl/locale-data/ru' in G:\work\webapp\code\client
resolve module react-intl/locale-data/ru in G:\work\webapp\code\client
  looking for modules in G:\work\webapp\node_modules
    resolve 'file' or 'directory' locale-data/ru in G:\work\webapp\node_modules\react-intl
      resolve file
        G:\work\webapp\node_modules\react-intl\locale-data\ru doesn't exist
        G:\work\webapp\node_modules\react-intl\locale-data\ru.json doesn't exist
        G:\work\webapp\node_modules\react-intl\locale-data\ru.js doesn't exist
      resolve directory
        G:\work\webapp\node_modules\react-intl\locale-data\ru doesn't exist (directory default file)
        G:\work\webapp\node_modules\react-intl\locale-data\ru\package.json doesn't exist (directory description file)

The reason is that there's no such folder.

The correct way would be require('react-intl/lib/locale-data/ru').
You should update your documentation.

Activity

  1. ericf commented on Nov 3, 2015

    @ericf
    Collaborator

    I'm using a main entry in the package.json file. It seems like you're having a problem with Webpack not respecting the proper Node.js main module resolution:

    https://nodejs.org/docs/latest-v0.12.x/api/modules.html#modules_accessing_the_main_module

    What version of Webpack are you using?

  2. catamphetamine commented on Nov 3, 2015

    @catamphetamine
    Author

    I don't know why isn't it working.

  3. nmaves commented on Dec 29, 2015

    @nmaves

    I am seeing this same issue with [email protected].

    import en from 'react-intl/locale-data/en';
    import fr from 'react-intl/locale-data/fr';
    
    addLocaleData(en);
    addLocaleData(fr);
    
    ERROR in ./app/App.js
    Module not found: Error: Cannot resolve module 'react-intl/locale-data/en' in /Users/nmaves/projects/.../app
     @ ./app/App.js 23:10-46
    
    ERROR in ./app/App.js
    Module not found: Error: Cannot resolve module 'react-intl/locale-data/fr' in /Users/nmaves/projects/.../app
     @ ./app/App.js 27:11-47
    
  4. nmaves commented on Dec 29, 2015

    @nmaves

    Could the issue be with babel 6?

  5. added 4 commits that reference this issue on Jan 13, 2016
    1dc62da
    3575e9e
    5f1397f
    36bd26e
  6. ansonla3 commented on Feb 2, 2016

    @ansonla3

    same issue + 1 , any ideas?

  7. added a commit that references this issue on Mar 28, 2016
  8. afsanefdaa commented on Aug 10, 2019

    @afsanefdaa

    I have the same issue because after yarn add react-intl when I check the node module folder I cant find the locale-data folder! Do you know why?

  9. afsanefdaa commented on Aug 10, 2019

    @afsanefdaa

    Actually I added the 2.9.0 version and the problem solved! But Why in the latest verrsion this important folder has been removed ?????

  10. sinwailam193 commented on Aug 10, 2019

    @sinwailam193

    Actually I added the 2.9.0 version and the problem solved! But Why in the latest verrsion this important folder has been removed ?????

    Got the same issue with the version 3.1.3 of react-intl

  11. longlho commented on Aug 10, 2019

    @longlho
    Member
  12. naneziris commented on Aug 27, 2019

    @naneziris

    We no longer distribute locale-data, please take a look at v3 Upgrade Guide https://github.com/formatjs/react-intl/blob/master/docs/Upgrade-Guide.md

    That is right guys, read the upgrade notes.
    You have to do sth like that instead:

    import '@formatjs/intl-relativetimeformat/polyfill';
    import '@formatjs/intl-relativetimeformat/dist/locale-data/en';
    import '@formatjs/intl-relativetimeformat/dist/locale-data/fr'

  13. Ivraie commented on Sep 13, 2019

    @Ivraie
    Contributor

    Hi, I have read the Upgrade Guide but I can't figure out how to include locale for en-US. I see only '@formatjs/intl-relativetimeformat/dist/locale-data/en';
    Does someone know how to do it ?

  14. longlho commented on Sep 13, 2019

    @longlho
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions