question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Metro fails with react-i18next

See original GitHub issue

Hey guys, I’m currently working on a project that is platfom-agnostic (react-native-web) with my own components and stuff, and I’d like to add i18next to the project. So it works fine on the web/desktop builds (react) but when it comes to mobile (react-native), the following error happens in Metro:

error: bundling failed: Error: While trying to resolve module `react-i18next` from file `/home/skyzohkey/Dev/React/Tox-Universal-Client/App.js`, the package `/home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/react-i18next/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/react-i18next/dist/commonjs/index.js`. Indeed, none of these files exist:

  * `/home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/react-i18next/dist/commonjs/index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
  * `/home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/react-i18next/dist/commonjs/index.js/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json)`
    at ResolutionRequest.resolveDependency (/home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:104:15)
    at DependencyGraph.resolveDependency (/home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/metro/src/node-haste/DependencyGraph.js:271:4465)
    at dependencies.map.relativePath (/home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/metro/src/DeltaBundler/traverseDependencies.js:379:19)
    at Array.map (<anonymous>)
    at resolveDependencies (/home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/metro/src/DeltaBundler/traverseDependencies.js:378:16)
    at /home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/metro/src/DeltaBundler/traverseDependencies.js:203:33
    at Generator.next (<anonymous>)
    at step (/home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/metro/src/DeltaBundler/traverseDependencies.js:296:307)
    at /home/skyzohkey/Dev/React/Tox-Universal-Client/node_modules/metro/src/DeltaBundler/traverseDependencies.js:296:467
    at <anonymous>
 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/4), failed.

If reported the issue on i18next repo too.

You can try yourself to reproduce by cloning my repository here: https://github.com/Tox-Client/client/

Thanks in advance guys, I’ve tried all I can do before opening that issue and I hope you will be better than me at finding the issue c:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SkyzohKeycommented, Mar 5, 2018

Ok let’s close this issue. I’ve removed the dist/ folder and passed "output": "packages/" to electron-builder. Thanks for the help man, sometimes issues are just dumbness (from me xD).

0reactions
SkyzohKeycommented, Mar 5, 2018

Mh, i will try. Lemme check 😉 It would be fine to have a less hacky way to ignore folders. ie.

getBlacklistArray() {
  return [
    '/dist/**/*',
    '*/__fixtures__/*'
  ];
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

i18next in React Native: import {t} doesn't work (works in React ...
Does it have something to do with how i18next is exported in typedefinitions ( export = i18next; )?. reactjs · typescript · react-native ......
Read more >
Step by step guide (v9) - react-i18next documentation
As the language is set on i18n.init you either could create some custom code setting the needed language or just use one of...
Read more >
Incorporate Localization into Your React App with react-i18next
I wanted to go over my simple implementation of react-i18next and highlight some of the core features needed to get everything working.
Read more >
Internationalization and localization in React Native
Internationalization, or i18n, is the process of building applications that can adapt to different cultures, regions, and languages.
Read more >
Grid enableStickyHeader throws error with react-i18next ...
We have logged a defect report for the issue “Enabling sticky header with react-i18next throws script error”. At Syncfusion, we are committed to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found