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.

Requiring unknown module "./lang/en"

See original GitHub issue

I’m trying to use this package in react-native, but unfortunately requiring the module results in the following error:

Requiring unknown module "./lang/en". If you are sure the module is there, try restarting the packager.

Is this something specific to the fact that I’m using react-native, or am I making a rookie mistake here? Any input would be appreciated.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10

github_iconTop GitHub Comments

4reactions
atomicleopardcommented, Jul 18, 2017

The fix for @danieloprado didn’t quite work for me - I adapted it to this, which I include in my root component (i.e. this is a global change).

import lang from 'validatorjs/src/lang';
import en from 'validatorjs/src/lang/en';
lang._set('en', en);
4reactions
compojoomcommented, Sep 26, 2016

A year later I ran into the same issue. The current stand is that the react native packager still doesn’t support dynamic require. So if you have the same issue you’ll have to change

var rawMessages = require('./lang/en');

if you need support for all the languages, the nyou’ll have to define each language and based on the value require it. Something like this

var langs = { en : ‘.langs/en’, de : ‘.langs/de’ }

Stupid, but that’s the way it works…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unhandled JS Exception: Requiring unknown module "104"
Getting error Unhandled JS Exception: Requiring unknown module "104". If you are sure the module exists, try restarting Metro.
Read more >
Error: Requiring unknown module '789' · Issue #3590 - GitHub
Error: Requiring unknown module "789". If you are sure the module exists, try restarting Metro. You may also want to run yarn or...
Read more >
I got this error message "Requiring unknown module "ws""
I got this error message "Requiring unknown module "ws"". Nicolas Charpentier. Moved from https://github.com/facebook/react-native/issues/9559.
Read more >
Requiring unknown Module "1171" React Native Error Fix
I faced one such react native error recently. It says Requiring unknown module “1171”. If you are sure the module is there, try...
Read more >
Requiring unknown module "498" error in ReactNative getting ...
I had the same issue. In my case, while creating a reusable component, I wasn't importing React into the file,as I was not...
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