react-native-purchases
react-native-purchases copied to clipboard
Invariant Violation: `new NativeEventEmitter()` Expo 51
Hi! I'm getting follow error on RN Expo 51. How I can fix that?
Invariant Violation: `new NativeEventEmitter()` requires a non-null argument., js engine: hermes
ERROR Invariant Violation: "main" 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
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
This error is normally due to a wrong installation of the plugin. I would suggest you clean metro caches, re-install your node modules and make sure you run pod install in your iOS folder since that can sometimes be the culprit
If that doesn't help, do you mind sharing the output you see when installing the plugin, and your Podfile.lock.
Thank you
I had this same issue. I tried what @vegaro said... I reset everything in my project regarding build files, include iOS folder etc. This resolved the issue temporarily but now this issue back
I am also using RN Expo 51.
Relinking the package seems to resolve the issue temporarily as well: npx expo install react-native-purchases
But its strange that this happens randomly
How could it be possible that the value RNPurchases being passed into NativeEventEmitter(RNPurchases) is null? https://github.com/RevenueCat/react-native-purchases/blob/main/src/purchases.ts#L64C45-L64C56
no luck here?
it's still happening on expo 52.
@Mazuh I just fixes it when installed pods
@maamalama , sorry, it means you had to eject your expo app to bare workflow?
(i'm with the expo managed workflow so I currently only have some minor idea of what even a pod is 💀)
i've found out that in my case I was running eas build -p ios so adding --profile development (which has "developmentClient": true, "distribution": "internal", "ios": { "simulator": true }, ... on eas.json fixed it. I think I was building non-dev assets and at the same time requiring dev assets on emulator, falling into a contradictory scenario.
I am experiencing this same issue
I was getting the same issue in react native cli then i did cd ios -> pod install but somehow the i was getting error on pod install so i did pod install --repo-update and it worked
Im getting this issue over and over again. It's preventing me from using Revenuecat. I've gone through all the install tutorials, I've done npx expo install react-native-purchases, pod installed, pod install --repo-update, deleted /ios and rebuilt, man, I've tried everything. Nothing is working. Importing the purchases package yields this error:
ERROR Warning: Invariant Violation: new NativeEventEmitter() requires a non-null argument., js engine: hermes
Im on expo 53, if that matters. So frustrating
still get this error with Expo52 ....
Hey, everyone. I initially had this issue as well when I first fired up my development app after installing the package. All I had to do was rebuild the development app, and it went away.