Skip to content

Invariant Violation: "myAppName" has not been registered #34893

Closed as not planned

Description

Description

i'm trying to running on ios emulator, but without success:

Invariant Violation: "myAppName" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

metro is started, and build, so i think the problem is:

  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called., js engine: hermes

Version

0.70.2

Output of npx react-native info

System:
OS: macOS 12.6
CPU: (8) arm64 Apple M1 Pro
Memory: 316.59 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.1 - /usr/local/bin/node
Yarn: Not Found
npm: 8.15.0 - /usr/local/bin/npm
Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/mantegnous/.rvm/gems/ruby-2.7.5/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9014738
Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^18.2.0 => 18.2.0
react-native: ^0.70.2 => 0.70.2
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

i'm running ios

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

image

Activity

  1. muzhaqi16 commented on Mar 10, 2023

    @muzhaqi16

    I am getting the same error after upgrading to react native 0.71.4

  2. student513 commented on Mar 10, 2023

    @student513

    same here

  3. muzhaqi16 commented on Mar 10, 2023

    @muzhaqi16

    Check the info before the error; that should tell you what's causing it. For me, it was react-native-reanimated.

     Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/swmansion/reanimated/NativeProxy;.registerEventHandler(Lcom/swmansion/reanimated/nativeProxy/EventHandler;)V", js engine: hermes
     LOG  Running "AwesomeProject" with {"rootTag":11}
     ERROR  Invariant Violation: "AwesomeProject" has not been registered. This can happen if:
    * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
    * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes
    
  4. allanrosero commented on Mar 14, 2023

    @allanrosero

    i got the same issue any solution yet?

    solved the issue by updating all the packages.

  5. brettbl commented on Apr 1, 2023

    @brettbl

    I getting the same issue except my issue doesn't appear to be related to the js engine: hermes. @ErickJ3 solution did not work for me. I'm running 0.71.4 and testing and iOS app.

  6. vivkikkk commented on Apr 4, 2023

    @vivkikkk

    Check the App name in MainActivity at getMainComponentName function, app.json, and package.json it will same in these 3 places.

  7. brettbl commented on Apr 5, 2023

    @brettbl

    Check the App name in MainActivity at getMainComponentName function, app.json, and package.json it will same in these 3 places.

    These all match but still experiencing the issue

  8. aniketjha9179 commented on Apr 9, 2023

    @aniketjha9179
    • A module failed to load due to an error and AppRegistry.registerComponent wasn't called., js engine: hermes
    • Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/swmansion/reanimated/NativeProxy;.registerEventHandler(Lcom/swmansion/reanimated/nativeProxy/EventHandler;)V", js engine: hermes
      LOG Running "naviRn" with {"rootTag":11}
      i am also getting this error now even I am running this app from the folder it should we run
  9. Chuabacca commented on Apr 12, 2023

    @Chuabacca

    Check the App name in MainActivity at getMainComponentName function, app.json, and package.json it will same in these 3 places.

    @methineeinkan After using the Upgrade Helper to go to 0.71.6, I had the wrong moduleName in my AppDelegate.mm file. Thanks!

  10. g-wozniak commented on May 29, 2023

    @g-wozniak

    Maybe it's trivial, but make sure your app.config.js or app.json contains "expo" property in the JSON/JS object. In my case it was missing and produced an error "ReferenceError: Property 'TextEncoder' doesn't exist, js engine: hermes" and A module failed to load due to an error and AppRegistry.registerComponent wasn't called., js engine: hermes. I took the config example from somewhere where it wasn't defined.
    So keep: {"expo": {"name": "xxx", ...}}

  11. thanhdat2106 commented on Jul 19, 2023

    @thanhdat2106

    I'm getting the same error, anyone have any solution?

  12. Ali-Rzaa commented on Aug 10, 2023

    @Ali-Rzaa

    I got the same error in mac for ios and solved it by running
    $ cd ios
    $ pod install
    $ cd ..
    and then started the metro by cleaning cache using following command
    $ npm start --reset-cache

  13. xieyezi commented on Sep 20, 2023

    @xieyezi

    Check the App name in MainActivity at getMainComponentName function, app.json, and package.json it will same in these 3 places.

    it's fo funny, I change name in app.json, it's not working. I don know that it's must same in these 3 places.

  14. fabio-jreis commented on Oct 3, 2023

    @fabio-jreis

    any solution? I got the same error runing on android

  15. TiagoAndreAlmeida commented on Oct 18, 2023

    @TiagoAndreAlmeida

    I got the same error, check the name os app in 3 files a the same.

  16. joaonew commented on Oct 30, 2023

    @joaonew

    Check the App name in MainActivity at getMainComponentName function, app.json, and package.json it will same in these 3 places.

    These all match but still experiencing the issue

    did you fix it? experiencing the same error with hermes

  17. afiq234 commented on Nov 4, 2023

    @afiq234

    I fix the problem by cold boot the avd

  18. binarybaba commented on Nov 29, 2023

    @binarybaba

    Could this be because the module fails to load and hence AppRegistry.registerComponent doesn't end up getting called?

  19. zecafeitosa commented on Mar 15, 2024

    @zecafeitosa

    Check the App name in MainActivity at getMainComponentName function, app.json, and package.json it will same in these 3 places.

    thank you, saved my life :D

  20. ronnioliveira commented on May 15, 2024

    @ronnioliveira

    same problem to run ios with react native 0.74. Same name in app.json, package.json and getMainComponentName. Any solution?

  21. deban007oss commented on May 22, 2024

    @deban007oss

    same problem on 0.74

  22. snanthagopal commented on May 31, 2024

    @snanthagopal

    Same problem on 0.73.8

  23. smit-luvani commented on Jul 28, 2024

    @smit-luvani

    same problem to run ios with react native 0.74. Same name in app.json, package.json and getMainComponentName. Any solution?

    Were you able to resolve? Is it due to react-native-navigation (https://github.com/wix/react-native-navigation) package?

  24. ganeshtak19 commented on Oct 7, 2024

    @ganeshtak19

    +1
    facing same problem on 0.74.0

  25. fionhua commented on Oct 30, 2024

    @fionhua

    +1
    facing same problem on "react-native": "0.74.5",

  26. Sadman95 commented on Dec 14, 2024

    @Sadman95

    Hi
    I am also facing the same issue though I have placed same name in the three places.

    • package.json
      image

    • app.json
      image

    • MainApplication.kt
      image

  27. ahmadprogrammer111 commented on Jan 16, 2025

    @ahmadprogrammer111

    Check the App name in MainActivity at getMainComponentName function, app.json, and package.json it will same in these 3 places.

    Yeah man it worked for me!!!

  28. DevDK12 commented on Jan 19, 2025

    @DevDK12

    Check the App name in MainActivity at getMainComponentName function, app.json, and package.json it will same in these 3 places.

    it's fo funny, I change name in app.json, it's not working. I don know that it's must same in these 3 places.

    Probably this was causing error, I changed back name in app.json and its working fine now

  29. ramilqO commented on Jul 8, 2025

    @ramilqO

    I solved this problem by changing name to required in AppRegistry.registerComponent("CORRECT_APP_NAME", () => App)

  30. sehy0803 commented on Jul 14, 2025

    @sehy0803

    I also made sure that the project name was consistent across all settings, including app.json.

    After that, I deleted the index.android.bundle file located at android/app/src/main/assets/ in the project root.

    Then I regenerated the bundle by running the following command in the terminal:

    npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle

    This resolved the issue for me.

  31. jayeshuk commented on Dec 31, 2025

    @jayeshuk

    I was having a react-native-web setup in my react-native project to support web along with android and ios.

    In my case, I configured an alias which was supposed to be only in webpack.config.js (for web) and not in babel.config.js (for mobile):

    resolve: {
        alias: {
          'react-native$': 'react-native-web',
        },
      },
    

    Once I removed this alias from babel.config.js, mobile part started working correctly and web part was intact as well.
    The error: "Invariant Violation: "myAppName" has not been registered" was resolved with this

  32. hariszulfiqar054 commented on Mar 3, 2026

    @hariszulfiqar054

    In my case it was a ts compile issue make sure to compile the code and resolve the error and reload the metro bundler

  33. react-native-bot commented on Aug 31, 2026

    @react-native-bot
    Collaborator

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  34. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Aug 31, 2026
  35. react-native-bot commented on Sep 7, 2026

    @react-native-bot
    Collaborator

    This issue was closed because it has been stalled for 7 days with no activity.

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

    Needs: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions