facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
117.14k stars 24.08k forks source link

Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication) #29564

Closed champion007 closed 1 year ago

champion007 commented 3 years ago

I have started getting this error Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication) since yesterday, my application was working and all of sudden it broke.

Google for hours most of them asked to - Delete your yarn.lock/package-json.lock file and run yarn/npm install. Then try clearing cache with npx react-native start --reset-cache but none of iit worked.

Tried deleting re-building the app but it fails with the same error

index.js

import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

package.json

"dependencies": {
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-community/datetimepicker": "^2.6.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/picker": "^1.6.5",
    "@react-native-community/slider": "^3.0.3",
    "@react-navigation/bottom-tabs": "^5.7.2",
    "@react-navigation/material-top-tabs": "^5.2.14",
    "@react-navigation/native": "^5.7.2",
    "@react-navigation/stack": "^5.8.0",
    "@types/react-native-svg-charts": "^5.0.3",
    "@types/react-redux": "^7.1.9",
    "lottie-ios": "3.1.8",
    "lottie-react-native": "^3.5.0",
    "moment": "^2.27.0",
    "react": "16.13.1",
    "react-moment": "^0.9.7",
    "react-native": "0.63.2",
    "react-native-gesture-handler": "^1.7.0",
    "react-native-reanimated": "^1.10.1",
    "react-native-safe-area-context": "^3.1.1",
    "react-native-screens": "^2.9.0",
    "react-native-svg": "^12.1.0",
    "react-native-svg-charts": "^5.4.0",
    "react-native-swipe-list-view": "^3.2.3",
    "react-native-swiper": "^1.6.0",
    "react-native-tab-view": "^2.15.0",
    "react-redux": "^7.2.1",
    "redux": "^4.0.5"
  }
github-actions[bot] commented 3 years ago
:warning: Missing Environment Information
:information_source: Your issue may be missing information about your development environment. You can obtain the missing information by running react-native info in a console.
MihaiDev08 commented 3 years ago

I got the same error today and after I run npm start or expo start again on my folder it worked.I hope it will work at you too!

champion007 commented 3 years ago

Tried it multiple times but it does not work :(

React-Native Info

info Fetching system and libraries information...
System:
    OS: macOS 10.15.3
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 202.43 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.18.2 - /usr/local/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6241897
    Xcode: /undefined - /usr/bin/xcodebuild
  npmPackages:
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.2 => 0.63.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7
    react-native: 0.61.5
github-actions[bot] commented 3 years ago
:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.
github-actions[bot] commented 3 years ago
:warning: Using Old Version
:information_source: It looks like you are using an older version of React Native. Please upgrade to the latest version, and verify if the issue persists. If it does not, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the current release.
littlepriest commented 3 years ago

:-( oh no, it is my mistake.....when my react native project launches, it needs to import some native files. These definitions wrote in file "app.js" like this: import { exampleFile1, exampleFile2 } from './path';

and i suddenly found that there are no files named 'exampleFile1' or 'exampleFile2'.....


I also have this problem. and this is the result i ran the command "react-native info":

System: OS: macOS 10.15.6 CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz Memory: 305.91 MB / 8.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.18.4 - /usr/local/bin/node Yarn: 1.22.5 - /usr/local/bin/yarn npm: 6.14.6 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 12.0/12A7209 - /usr/bin/xcodebuild Languages: Java: Not Found Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.2 => 0.63.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

failed to install the package "@react-native-community/cli: " and " react-native-macos".

yt-dev commented 3 years ago

I get the same error, (react-native version 0.63.2) ERROR TypeError: Super expression must either be null or a function ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication) ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

markneh commented 3 years ago

I also had same issue. However, I updated react-native-keyboard-aware-scroll-view from 0.9.1 to 0.9.2 and it fixed the issue for me

ramonvermeulen commented 3 years ago

Getting the same error right here.. react-native 0.63.2

enestatli commented 3 years ago

rm -rf node_modules package-lock.json npm install

worked for me, tested on both react-native version 0.63.2/3

ghoshabhi commented 3 years ago

package-lock.json should never be deleted. That is the whole purpose of having the lock file.

lexdenotter commented 3 years ago

I also have the same error here on RN 0.63.3..

tiagobnobrega commented 3 years ago

I was having the same error. But this message was also displayed: TypeError: undefined is not an object (evaluating 'b.apply')

I've managed to trace it back to this in my Redux Store:

(window as any).__REDUX_DEVTOOLS_EXTENSION__ &&
      (window as any).__REDUX_DEVTOOLS_EXTENSION__(),

After removing this, It worked again in my case. I'm guessing this happens when some exception is thrown early on app loading.

evalenzuela commented 3 years ago

I was just having same error. In my case the error was related to node version.

RoberManuki commented 3 years ago

I got the same error today and after I run npm start or expo start again on my folder it worked.I hope it will work at you too!

Also worked for me!

vosters commented 3 years ago

I was just having same error. In my case the error was related to node version.

@evalenzuela I just updated my node and am now getting this issue. Can you explain what you did to resolve? And what version of node you were on?

flyskywhy commented 3 years ago

In my case, after a git commit cause the error, then I found the wrong code in the commit is:

static emitter = Platform.OS === 'ios' ? new NativeEventEmitter(NativeModule) : DeviceEventEmitter;

where the NativeModule is null because I have not implemented it on iOS :stuck_out_tongue_closed_eyes:

When I edit it to

static emitter = Platform.OS === 'ios' ? {} : DeviceEventEmitter;

then the error Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication) is gone!

imsam67 commented 2 years ago

This definitely seems to be caused by developer error. In my case, a misspelled variable name in one of the util functions I was calling was the cause of the error.

Unfortunately, the error message doesn't say much and doesn't point to a particular place in the code. In my case, I pretty much spent the entire day troubleshooting so the whole day was wasted.

My suggestion to the next person who's having this issue is to stop complaining and pointing fingers and start looking at your code very very very carefully.

gabsist commented 2 years ago

rm -rf node_modules package-lock.json

It works for me! tks

muhamedoufi commented 1 year ago

I get the same error, (react-native version 0.63.2) ERROR TypeError: Super expression must either be null or a function ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication) ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

did you find solution?

github-actions[bot] commented 1 year ago

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because the author hasn't provided the requested feedback after 7 days.