react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Invariant Violation: "myAppName" has not been registered

Open mantegnous opened this issue 1 year ago • 34 comments

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

mantegnous avatar Oct 07 '22 07:10 mantegnous

"dependencies": { "@gorhom/bottom-sheet": "^4.4.5", "@ptomasroos/react-native-multi-slider": "^2.2.2", "@react-native-async-storage/async-storage": "^1.17.10", "@react-native-firebase/analytics": "^14.12.0", "@react-native-firebase/app": "^14.12.0", "@react-native-firebase/crashlytics": "^14.12.0", "@react-navigation/bottom-tabs": "^6.4.0", "@react-navigation/material-top-tabs": "^6.2.4", "@react-navigation/native": "^6.0.13", "@react-navigation/stack": "^6.3.1", "@reduxjs/toolkit": "^1.8.5", "@stripe/stripe-react-native": "^0.19.0", "@ungap/url-search-params": "^0.2.2", "axios": "^0.27.2", "card-validator": "^8.1.1", "decimal.js": "^10.4.1", "fbjs": "^3.0.4", "i18next": "^21.9.2", "ibantools": "^4.1.4", "intl-pluralrules": "^1.3.1", "lodash": "^4.17.21", "moment": "^2.29.4", "patch-package": "^6.4.7", "prop-types": "^15.8.1", "qs": "^6.10.3", "react": "^18.2.0", "react-hook-form": "^7.37.0", "react-i18next": "^11.18.6", "react-native": "^0.70.2", "react-native-anchor-carousel": "^4.0.1", "react-native-appsflyer": "^6.9.1", "react-native-bootsplash": "^4.3.2", "react-native-color-matrix-image-filters": "^5.2.14", "react-native-config": "^1.4.4", "react-native-device-info": "^10.2.0", "react-native-dropdown-picker": "^5.4.0", "react-native-elements": "^3.4.2", "react-native-error-boundary": "^1.1.16", "react-native-fast-image": "^8.6.1", "react-native-gesture-handler": "^2.6.1", "react-native-google-places-autocomplete": "^2.4.1", "react-native-input-spinner": "^1.7.12", "react-native-keyboard-manager": "^6.5.4-4", "react-native-linear-gradient": "^2.6.2", "react-native-mask-text": "^0.12.1", "react-native-pager-view": "^6.0.0", "react-native-reanimated": "^2.10.0", "react-native-safe-area-context": "^4.3.4", "react-native-screens": "^3.17.0", "react-native-snackbar-component": "^1.1.12", "react-native-step-indicator": "^1.0.3", "react-native-svg": "^13.2.0", "react-native-swipe-list-view": "^3.2.9", "react-native-tab-view": "^3.2.1", "react-native-textindicator-sectionlist-sidebar": "0.0.16", "react-native-tracking-transparency": "^0.1.2", "react-native-use-keyboard-height": "^0.1.1", "react-native-vector-icons": "^9.1.0", "react-redux": "^8.0.4", "redux-persist": "^6.0.0", "redux-saga": "^1.2.1", "sp-react-native-in-app-updates": "^1.2.0" }, "devDependencies": { "@babel/core": "^7.19.3", "@babel/runtime": "^7.19.0", "@react-native-community/eslint-config": "^3.1.0", "babel-jest": "^29.1.2", "babel-plugin-module-resolver": "^4.1.0", "eslint": "^8.23.1", "eslint-import-resolver-babel-module": "^5.3.1", "eslint-plugin-import": "^2.26.0", "jest": "^29.1.2", "metro-config": "^0.73.0", "metro-react-native-babel-preset": "^0.73.0", "prettier": "^2.6.2", "react-native-codegen": "^0.70.5", "react-native-svg-transformer": "^1.0.0", "react-native-touchable-scale": "^2.2.0", "react-test-renderer": "^18.2.0" },

mantegnous avatar Oct 07 '22 10:10 mantegnous

having the same problem

Daha62 avatar Oct 26 '22 13:10 Daha62

Problem solved by fixing deprecated-react-native-prop-types

Daha62 avatar Oct 31 '22 03:10 Daha62

Hey @Daha62

If your problem is solved can you please close the issue? It sparks joy for maintainers ✨

flexbox avatar Jan 05 '23 14:01 flexbox

@mantegnous did you fix the issue ? I'm having the same problem, solving the deprecated-react-native-prop-types issues did not help.

sam-houle1 avatar Jan 12 '23 20:01 sam-houle1

Someone has fix this issue ? I got the error with Android, but not with iOS.

AlessioCamm avatar Jan 16 '23 09:01 AlessioCamm

I'm getting this on RN 0.71, any solution?

RalissonMattias avatar Jan 17 '23 14:01 RalissonMattias

I had this issue on 0.88.5, but the reason I had this error is because I'm using wix/react-native-navigation, I had to enter npx rnn-link to resolve this issue.

Could also be because in some native file, the project name is still have some rndiffapp in some native file.

sam-houle1 avatar Jan 17 '23 18:01 sam-houle1

anyone solved this issue?

Yeasirarafat53 avatar Jan 31 '23 11:01 Yeasirarafat53

i solved this problem by ending adb(32bit) from task manager then i run the project on my real device it successful worked

Sulemannnn avatar Feb 07 '23 19:02 Sulemannnn

i solved this problem by ending adb(32bit) from task manager then i run the project on my real device it successful worked

let me know if this works for you guys as well thanks!

Sulemannnn avatar Feb 07 '23 19:02 Sulemannnn

I'm getting this on RN 0.71, any solution?

Same here.

AdeelTanveerM avatar Feb 11 '23 15:02 AdeelTanveerM

Problem solved by fixing deprecated-react-native-prop-types

ASSALM O ALAIKUM DAHA PLEASE SOLVE FOR ME I CAN;T FIND THE SOLUTION

HAQAN-797 avatar Mar 01 '23 10:03 HAQAN-797

any solution?

hassanharoon321 avatar Mar 10 '23 10:03 hassanharoon321

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

muzhaqi16 avatar Mar 10 '23 16:03 muzhaqi16

same here

student513 avatar Mar 10 '23 17:03 student513

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

muzhaqi16 avatar Mar 10 '23 18:03 muzhaqi16

i got the same issue any solution yet?

solved the issue by updating all the packages.

allanrosero avatar Mar 14 '23 12:03 allanrosero

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.

brettbl avatar Apr 01 '23 17:04 brettbl

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

vivkikkk avatar Apr 04 '23 14:04 vivkikkk

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

brettbl avatar Apr 05 '23 13:04 brettbl

  • 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

aniketjha9179 avatar Apr 09 '23 12:04 aniketjha9179

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!

Chuabacca avatar Apr 12 '23 20:04 Chuabacca

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", ...}}

g-wozniak avatar May 29 '23 12:05 g-wozniak

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

thanhdat2106 avatar Jul 19 '23 01:07 thanhdat2106

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

Ali-Rzaa avatar Aug 10 '23 12:08 Ali-Rzaa

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.

xieyezi avatar Sep 20 '23 07:09 xieyezi

any solution? I got the same error runing on android

fabio-jreis avatar Oct 03 '23 19:10 fabio-jreis

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

TiagoAndreAlmeida avatar Oct 18 '23 18:10 TiagoAndreAlmeida

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

joaonew avatar Oct 30 '23 21:10 joaonew