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 "undefined"

See original GitHub issue

Error after upgrading 0.54.0 from 0.53.3.

Requiring unknown module “undefined”.If you are sure the module is there, try restarting Metro Bundler. You may also want to run yarn, or npm install (depending on your environment). handleException @ ExceptionsManager.js:65 handleError @ InitializeCore.js:115 reportFatalError @ error-guard.js:44 guardedLoadModule @ require.js:141 _require @ require.js:130 executeApplicationScript @ debuggerWorker.js:40 (anonymous) @ debuggerWorker.js:65 ExceptionsManager.js:65 Module AppRegistry is not a registered callable module (calling runApplication)

Environment

Environment: OS: macOS High Sierra 10.13.3 Node: 8.9.4 Yarn: 1.5.1 npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed) react: ^16.3.0-alpha.1 => 16.3.0-alpha.1 react-native: 0.54.0 => 0.54.0

Expected Behavior

App should launch

Actual Behavior

UnknownModuleError

Steps to Reproduce

react-native run-android

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:41
  • Comments:49 (6 by maintainers)

github_iconTop GitHub Comments

56reactions
wildseansycommented, Mar 14, 2018

I was able to resolve this issue for my project by doing the following…

Given that this issue seems to be caused when there is import {y} from './x' and import {z} from 'myapp/x' in the same file, I was able to track down these files with these steps:

  1. Run your app until you get the error message
  2. In the stack trace, click on the filename included from your project, under one of the _require items in the stack trace. See screenshot below:

Be sure you have set the REACT_EDITOR variable set so react-native can open the file with an editor

simulator screen shot - iphone 7 - 2018-03-14 at 07 23 53

In my file (actions.js), before changes

import {
  getUserEmail
} from 'myapp/user/selectors';

import {
  getUserName
} from './selectors';  //<-- same file as 'myapp/user/selectors'. This is why metro crashes

actions.js after changes

// Change the above to: 
import {
  getUserEmail,
  getUserName
} from 'myapp/user/selectors';

This will also work:


// Or you can change it to: 
import {
  getUserEmail,
  getUserName
} from './selectors';

Now run your app again, and you may get the same error, but it will now point to a different file (assuming you have resolved all imports in the first file). If you get the error in a new file, repeat steps above until all files are cleaned up.

I had to do this 3-4 times before I had found all of the modules that have import {y} from './x' and import {z} from 'myapp/x' in the same file. Hope this helps someone else.

37reactions
HumanUndeadcommented, Mar 6, 2018

It will work but its up to you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Requiring unknown module "undefined". If you are sure ...
I had a similar problem with another npm package, then I went to the npm package node module js file. There you will...
Read more >
ERROR Error: Requiring unknown module "undefined"
I already try remove node_modules. I tried use Material Bottom Tab but i get the same error. edit 1. ERROR TypeError: undefined is...
Read more >
Requiring unknown module "undefined". If you are sure the ...
Error: Requiring unknown module "undefined". If you are sure the module exists, try restarting Metro. You may also want to run yarn or...
Read more >
[Solved]-Requiring unknown module "undefined"-React Native
Coding example for the question Requiring unknown module "undefined"-React Native.
Read more >
requiring unknown module 1298
Requiring unknown module "573".If you are sure the module is there, try restarting Metro Bundler. Requiring unknown module “undefined” on react-native-maps. 1.
Read more >

github_iconTop Related Medium Post

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