Skip to content

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). When Upgrading To React Native v0.70 #34688

Closed

Description

@nmassey2

Description

Upgrade from 0.68.1 to 0.70.0.
Builds fine in Xcode.
Launches Simulator.
Splash screen for app appears.

and then it crashes with the error:

ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes

Version

0.70.0

Output of npx react-native info

ystem:
OS: macOS 12.3.1
CPU: (4) x64 Intel(R) Core(TM) i7-4578U CPU @ 3.00GHz
Memory: 1.20 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 16.15.0 - /usr/local/bin/node
Yarn: Not Found
npm: 8.5.5 - /usr/local/bin/npm
Watchman: 2022.03.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Upgrade from 0.68.1 to 0.70.0.
Builds fine in Xcode.
Launches Simulator.
Splash screen for app appears.

and then it crashes with the error:

ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes

Snack, code example, screenshot, or link to a repository

Screen Shot 2022-09-14 at 7 06 35 AM

Activity

  1. spearghost commented on Sep 15, 2022

    @spearghost

    i have the same issue

  2. mmgmail commented on Sep 15, 2022

    @mmgmail

    i have the same issue too

  3. sahillamba123 commented on Sep 15, 2022

    @sahillamba123

    +1

  4. JevFR commented on Sep 15, 2022

    @JevFR

    Same here too

  5. JevFR commented on Sep 15, 2022

    @JevFR

    I succeed to avoid this error. In my case, it was due to the react-native-gesture-handler that changed.

    Previously we needed to import it at the top of the root file, now we must do that in App.js instead

    import { GestureHandlerRootView } from 'react-native-gesture-handler';
    /* ... */
    // Wrap your app with the new GestureHandler
    <GestureHandlerRootView style={{ flex: 1 }}>
      /* your app */
    </GestureHandlerRootView>

    Hope it will help

  6. HZHCoder1990 commented on Sep 15, 2022

    @HZHCoder1990

    i have the same issue too

  7. optitrac commented on Sep 15, 2022

    @optitrac

    Also having this issue

  8. efstathiosntonas commented on Sep 16, 2022

    @efstathiosntonas

    In my case it was ViewPropTypes from react-native-camera, I've applied this patch:

    diff --git a/node_modules/react-native-camera/src/RNCamera.js b/node_modules/react-native-camera/src/RNCamera.js
    index b7a271a..bf729e6 100644
    --- a/node_modules/react-native-camera/src/RNCamera.js
    +++ b/node_modules/react-native-camera/src/RNCamera.js
    @@ -1,11 +1,11 @@
     // @flow
     import React from 'react';
     import PropTypes from 'prop-types';
    +import {ViewPropTypes} from 'deprecated-react-native-prop-types';
     import {
       findNodeHandle,
       Platform,
       NativeModules,
    -  ViewPropTypes,
       requireNativeComponent,
       View,
       ActivityIndicator,

    and the error went away, note that I hade to manually install: yarn add deprecated-react-native-prop-types.

    The error you have above is incomplete, you're missing this important part:

    TypeError: undefined is not an object (evaluating '_reactnative.Text.propTypes.style')

  9. jyotiprakash111 commented on Sep 17, 2022

    @jyotiprakash111

    I succeed to avoid this error. In my case, it was due to the react-native-gesture-handler that changed.

    Previously we needed to import it at the top of the root file, now we must do that in App.js instead

    import { GestureHandlerRootView } from 'react-native-gesture-handler';
    /* ... */
    // Wrap your app with the new GestureHandler
    <GestureHandlerRootView style={{ flex: 1 }}>
      /* your app */
    </GestureHandlerRootView>

    Hope it will help

    Not worked for me.

  10. jyotiprakash111 commented on Sep 17, 2022

    @jyotiprakash111

    Any update on the same ? react-native-bot

  11. optitrac commented on Sep 18, 2022

    @optitrac

    I found that, similar to the OP, I had an error listed above the 'Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication().'. (In my case, the error was "Invariant Violation: ViewPropTypes has been removed from React Native", which was caused by two libraries in the node_modules folder). When I fixed that error (by applying patches to those libraries), the two 'AppRegistry' errors disappeared as well.

  12. vickyhrithik commented on Sep 19, 2022

    @vickyhrithik

    any update on the issues?

  13. putuoka commented on Sep 20, 2022

    @putuoka

    Same issue here after upgrading all of dependencies my old project with yarn yarn yarn-upgrade-all

    image

    my package.json:

    {
      "name": "-",
      "version": "0.0.1",
      "osmiVersion": "1.1.0",
      "private": true,
      "scripts": {
        "android": "react-native run-android",
        "ios": "react-native run-ios",
        "start": "react-native start --reset-cache",
        "test": "jest",
        "lint": "eslint .",
        "format": "prettier --check ./App"
      },
      "dependencies": {
        "@fortawesome/fontawesome-svg-core": "^6.2.0",
        "@fortawesome/free-brands-svg-icons": "^6.2.0",
        "@fortawesome/free-regular-svg-icons": "^6.2.0",
        "@fortawesome/pro-light-svg-icons": "^6.2.0",
        "@fortawesome/pro-regular-svg-icons": "^6.2.0",
        "@fortawesome/pro-solid-svg-icons": "^6.2.0",
        "@fortawesome/react-native-fontawesome": "^0.3.0",
        "@monterosa/react-native-parallax-scroll": "^1.8.0",
        "@react-native-async-storage/async-storage": "^1.17.10",
        "@react-native-community/datetimepicker": "^6.3.4",
        "@react-native-community/masked-view": "^0.1.11",
        "@react-native-firebase/analytics": "^15.6.0",
        "@react-native-firebase/app": "^15.6.0",
        "@react-native-firebase/messaging": "^15.6.0",
        "@react-native-firebase/perf": "^15.6.0",
        "@react-navigation/bottom-tabs": "^6.4.0",
        "@react-navigation/drawer": "^6.5.0",
        "@react-navigation/native": "^6.0.13",
        "@react-navigation/stack": "^6.3.1",
        "@sentry/react-native": "5.0.0-alpha.1",
        "add": "^2.0.6",
        "apisauce": "^2.1.6",
        "dayjs": "^1.11.5",
        "enzyme": "^3.11.0",
        "enzyme-adapter-react-16": "^1.15.6",
        "formik": "^2.2.9",
        "lodash": "^4.17.21",
        "osmicsx": "^0.6.10",
        "prop-types": "^15.8.1",
        "ramda": "^0.28.0",
        "react": "^18.2.0",
        "react-native": "^0.70.1",
        "react-native-animatable": "^1.3.3",
        "react-native-autoheight-webview": "^1.6.4",
        "react-native-background-downloader": "^2.3.4",
        "react-native-config": "^1.4.6",
        "react-native-device-info": "^10.2.0",
        "react-native-dropdown-picker": "^5.4.2",
        "react-native-fast-image": "^8.6.1",
        "react-native-file-viewer": "^2.1.5",
        "react-native-fluid-transitions": "^0.1.1",
        "react-native-gallery-swiper": "^1.26.4",
        "react-native-geolocation-service": "^5.3.0",
        "react-native-gesture-handler": "^2.6.1",
        "react-native-image-crop-picker": "^0.38.0",
        "react-native-intl-phone-input": "^1.2.27",
        "react-native-keyboard-spacer": "^0.4.1",
        "react-native-linear-gradient": "^2.6.2",
        "react-native-localize": "^2.2.3",
        "react-native-modal": "^13.0.1",
        "react-native-modal-datetime-picker": "^14.0.0",
        "react-native-modal-selector": "^2.1.1",
        "react-native-multiple-select": "^0.5.11",
        "react-native-parallax-scroll-view": "^0.21.3",
        "react-native-passkit-wallet": "^0.1.6",
        "react-native-reanimated": "^2.10.0",
        "react-native-render-html": "^6.3.4",
        "react-native-safe-area-context": "^4.3.4",
        "react-native-safe-area-view": "^1.1.1",
        "react-native-screens": "^3.17.0",
        "react-native-shared-element": "^0.8.4",
        "react-native-shimmer-placeholder": "^2.0.9",
        "react-native-simple-toast": "^1.1.4",
        "react-native-status-bar-height": "^2.6.0",
        "react-native-svg": "^13.2.0",
        "react-native-swiper": "^1.6.0",
        "react-native-vector-icons": "^9.2.0",
        "react-native-video": "^5.2.1",
        "react-native-video-player": "^0.14.0",
        "react-native-webview": "^11.23.1",
        "react-navigation-shared-element": "^3.1.3",
        "react-redux": "^8.0.2",
        "reactotron-react-native": "^5.0.2",
        "redux": "^4.2.0",
        "redux-persist": "^6.0.0",
        "redux-saga": "^1.2.1",
        "reduxsauce": "^1.2.1",
        "rn-fetch-blob": "^0.12.0",
        "seamless-immutable": "^7.1.4",
        "url-parse": "^1.5.10",
        "yarn": "^1.22.19",
        "yarn-upgrade-all": "^0.7.1",
        "yup": "^0.32.11"
      },
      "devDependencies": {
        "@babel/core": "^7.19.1",
        "@babel/runtime": "^7.19.0",
        "@react-native-community/eslint-config": "^3.1.0",
        "babel-jest": "^29.0.3",
        "babel-plugin-ignite-ignore-reactotron": "^0.3.0",
        "eslint": "^8.23.1",
        "eslint-plugin-prettier": "^4.2.1",
        "eslint-plugin-react": "^7.31.8",
        "jest": "^29.0.3",
        "metro-react-native-babel-preset": "^0.72.3",
        "prettier": "^2.7.1",
        "react-dom": "^18.2.0",
        "react-native-svg-transformer": "^1.0.0",
        "react-test-renderer": "^18.2.0",
        "reactotron-redux": "^3.1.3",
        "reactotron-redux-saga": "^4.2.3"
      },
      "jest": {
        "preset": "react-native",
        "testMatch": [
          "<rootDir>/Tests/**/*.js",
          "**/?(*.)(spec|test).js?(x)"
        ],
        "testPathIgnorePatterns": [
          "/node_modules/",
          "<rootDir>/Tests/Setup.js"
        ],
        "moduleNameMapper": {
          "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy"
        },
        "transform": {
          "^.+\\.(js)$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
        },
        "setupFiles": [
          "<rootDir>/Tests/Setup"
        ]
      },
      "config": {},
      "standard": {
        "parser": "babel-eslint",
        "globals": [
          "describe",
          "test",
          "jest",
          "expect",
          "fetch",
          "navigator",
          "__DEV__",
          "XMLHttpRequest",
          "FormData",
          "React$Element"
        ]
      }
    }
    
    
  14. 239 remaining items

  15. deivyrene commented on Oct 20, 2023

    @deivyrene

    Seeing this error in my console as well. Is there any better fix than hacking the node_modules or downgrading ReactNative?

    using RN 0.72.6

    @steventnorris

    Did the error occur when upgrading to RN 0.72.6?

    If you come from a version previous to 0.7x.x you must check which dependency is incompatible with the new version of react native.

    Applying this setting helped me to visualize which dependencies were causing the error.

    Once you fix the errors you can restore the file you edited in node_modules (this change is just to make it more visible what is going wrong)

    I hope it helps!

  16. removed
    Stale
    on Oct 21, 2023
  17. github-actions commented on Nov 14, 2023

    @github-actions

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

  18. added
    Stale
    on Nov 14, 2023
  19. github-actions commented on Nov 21, 2023

    @github-actions

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

  20. bigman1208000 commented on Nov 22, 2023

    @bigman1208000

    Hi @efstathiosntonas,
    I had the same issue and just followed your instructions.
    It really worked for me.
    Thank you very much.

  21. Antarpreet commented on Feb 16, 2024

    @Antarpreet

    I faced the same issue when upgrading Expo from 49 to 50 and react-native from 0.72.3 to 0.73.4 with the following error:

    Invariant Violation: Failed to call into JavaScript module method SOME_MODULE_NAME_HERE. Module has not been registered as callable. Bridgeless Mode: false. Registered callable JavaScript modules (n = 0):
    

    I resolved the issue by searching for react-native in the package-lock.json file and checking if any dependency had a lower version being used, for example, the following package was using the older 0.72.4 version than the new version in package.json file:

    "node_modules/react-native-shake": {
      "version": "5.6.0",
      "dependencies": {
        "react": "^18.2.0",
        "react-native": "0.72.4"
      },
      "peerDependencies": {
        "react": "*",
        "react-native": "*"
      }
    }
    

    I added an overrides option to the package.json file as follows:

    "dependencies": {
      ...
    },
    "overrides": {
      "react-native-shake": {
        "react-native": "0.73.4"
      }
    }
    

    Then, I removed node_modules and package-lock.json and re-installed dependencies after adding the overrides section.

    This resolved the issue after re-running the metro server and re-installing the app.

    This is a temporary solution as we are modifying the sub-dependencies of our dependencies which may lead to unexpected behavior. The correct solution is to upgrade the affected dependency itself.

  22. mdrijwan commented on Feb 20, 2024

    @mdrijwan

    i'm also facing the same issue :(

  23. codekojo commented on Mar 20, 2024

    @codekojo

    +1

  24. Sandoval-dev commented on Mar 26, 2024

    @Sandoval-dev

    I fixed my issue by updating everything including 47.x.x -> expo sdk 48.x.x

    Code was working on android, testing on a new ios device didn't work. (IOS expo go was a version ahead) a bare 'expo init newProjectName', project worked, copied my package.json and 'expo install' still worked, copied everything but App.js and it worked, copied App.js and it didn't. ran 'expo upgrade', android stopped working, ios started. Updated 'expo go' on android. and it worked

    expo upgrade worked for me

  25. SailendraRapeti commented on Apr 23, 2024

    @SailendraRapeti

    I succeed to avoid this error. In my case, it was due to the react-native-gesture-handler that changed.

    Previously we needed to import it at the top of the root file, now we must do that in App.js instead

    import { GestureHandlerRootView } from 'react-native-gesture-handler';
    /* ... */
    // Wrap your app with the new GestureHandler
    <GestureHandlerRootView style={{ flex: 1 }}>
      /* your app */
    </GestureHandlerRootView>

    Hope it will help

  26. SailendraRapeti commented on Apr 23, 2024

    @SailendraRapeti

    it's not worked for me

  27. tripolskypetr commented on Jul 30, 2024

    @tripolskypetr

    Still waiting for 1.0 release without that pretty debugger)

  28. victorsfranco commented on Sep 18, 2024

    @victorsfranco

    Hey everyone! After 3 days, I found a solution for this bug in my case. It was being caused by ViewPropTypes, that dont exist anymore on 'react-native' package. We have to import it from 'deprecated-react-native-prop-types'.

    I was was not getting to find what dependency was using this prop, but I found out that ir wasn't found due to a specific VS Code configuration.

    icon

    You guys should click on this Icon, to disable this option, that hide the term ocurrences on some directories inside node_modules. After clicking on it, you will be able to locate where this prop are being used, and fix the bug, like I did below:

    before

    after

    .
    .

    To persist this change, you can take a look on patch-package repo:

    https://github.com/ds300/patch-package

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: AppRegistryNeeds: Author FeedbackNeeds: ReproNeeds: Triage 🔍StaleType: Upgrade Issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions