Question

unable to import Purchases due to ERROR Invariant Violation: `new NativeEventEmitter()` requires a non-null argument

  • 4 June 2024
  • 3 replies
  • 360 views

Badge +1

I am trying to use Purchases in an expo project.

If I build with xcode, everything is fine. 

However, we rely on the expo development build during development.  Because ain’t nobody got time for xcode. 

If I try to run with the expo dev server (npx expo run:ios) then I get the error  ERROR  Invariant Violation: `new NativeEventEmitter()` requires a non-null argument., js engine: hermes

this happens at the time of import of Purchases (import Purchases from “react-native-purchases”).

I followed the standard installation and usage for expo.

It looks like this might be some sort of incompatibility with  NativeViewGestureHandler because that also starts generating errors only when I try to import Purchases.

Note that I know that purchases probably won’t work in this mode, at least on the simulator, but it shouldn’t crash the app.  That makes for some really challenging dx.

 

 

 


This post has been closed for comments

3 replies

I have the same issue, I’m stuck but I thing that the solution for this is use another library

Badge +1

I am able to use eas build now, and I can get it to run on my phone without this error.  It still crashes when I run the simulator, though.

Userlevel 4
Badge +8

Hey @dustin-carr-4a3223 can you share which version of the sdk you’re using? 

We had an issue here that we fixed in v7.26.0 that may be related