Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invariant Violation: new NativeEventEmitter() Expo 51 #1087

Open
maamalama opened this issue Sep 15, 2024 · 3 comments
Open

Invariant Violation: new NativeEventEmitter() Expo 51 #1087

maamalama opened this issue Sep 15, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@maamalama
Copy link

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

simulator_screenshot_A301373E-F9D2-4C88-91B6-CA371F794BC1

@maamalama maamalama added the bug Something isn't working label Sep 15, 2024
@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@vegaro
Copy link
Contributor

vegaro commented Sep 16, 2024

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

@Kylescottw
Copy link

Kylescottw commented Oct 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants