facebook / react-native

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

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

Open mantegnous opened 2 years ago

mantegnous commented 2 years ago

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:

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 commented 2 years ago

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

Daha62 commented 2 years ago

having the same problem

Daha62 commented 2 years ago

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

flexbox commented 1 year ago

Hey @Daha62

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

sam-houle1 commented 1 year ago

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

AlessioCamm commented 1 year ago

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

RalissonMattias commented 1 year ago

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

sam-houle1 commented 1 year ago

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.

Yeasirarafat53 commented 1 year ago

anyone solved this issue?

Sulemannnn commented 1 year ago

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

Sulemannnn commented 1 year ago

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!

AdeelTanveerM commented 1 year ago

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

Same here.

HAQAN-797 commented 1 year ago

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

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

hassanharoon321 commented 1 year ago

any solution?

muzhaqi16 commented 1 year ago

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

student513 commented 1 year ago

same here

muzhaqi16 commented 1 year ago

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
allanrosero commented 1 year ago

i got the same issue any solution yet?

solved the issue by updating all the packages.

brettbl commented 1 year ago

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.

vivkikkk commented 1 year ago

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

brettbl commented 1 year ago

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

aniketjha9179 commented 1 year ago
Chuabacca commented 1 year ago

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!

g-wozniak commented 1 year ago

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

thanhdat2106 commented 1 year ago

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

Ali-Rzaa commented 1 year ago

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

xieyezi commented 1 year ago

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.

fabio-jreis commented 1 year ago

any solution? I got the same error runing on android

TiagoAndreAlmeida commented 1 year ago

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

joaonew commented 1 year ago

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

afiq234 commented 12 months ago

I fix the problem by cold boot the avd

binarybaba commented 11 months ago

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

zecafeitosa commented 7 months ago

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

ronnioliveira commented 5 months ago

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

deban007oss commented 5 months ago

same problem on 0.74

snanthagopal commented 5 months ago

Same problem on 0.73.8

smit-luvani commented 3 months ago

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?

ganeshtak19 commented 3 weeks ago

+1 facing same problem on 0.74.0

fionhua commented 2 days ago

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