OpenNative / open-native

Open Native brings cross-platform communities together to help them collaborate and strengthen each other through development diversity.
https://open-native.org/
MIT License
454 stars 8 forks source link

Fatal error...new NativeEventEmitter() requires a non-null argument #12

Closed bretep closed 1 year ago

bretep commented 1 year ago

Description

This error seems to throw when building from a clean environment. After the first build and run, this error expresses itself along with the app crashing upon startup. After exiting the run and running again, the error does not manifest, and the app startup as expected. See the steps to reproduce below.

Versions

"@open-native/core": "1.0.0-alpha.9", "react-native-auth0": "2.13.3",

Error

Restarting application on device F3C7587C-166D-48BA-92F0-085892E2FC86...
  ***** Fatal JavaScript exception - application has been terminated. *****
  NativeScript encountered a fatal error: Uncaught Error: `new NativeEventEmitter()` requires a non-null argument.
  at
  NativeEventEmitter(file: app/webpack:/test-app/node_modules/@open-native/core/Libraries/EventEmitter/NativeEventEmitter.js:25:0)
  at _Linking(file: app/webpack:/test-app/node_modules/@open-native/core/Libraries/Linking/Linking.js:23:0)
  at ./node_modules/@open-native/core/Libraries/Linking/Linking.js(file: app/webpack:/test-app/node_modules/@open-native/core/Libraries/Linking/Linking.js:112:7)
  at __webpack_require__(file: app/webpack:/test-app/webpack/bootstrap:24:0)
  at fn(file: app/webpack:/test-app/webpack/runtime/hot module replacement:62:0)
  at ./node_modules/@open-native/core/index.ios.js(file:///app/vendor.js:49208:84)
  at __webpack_require__(file: app/webpack:/test-app/webpack/bootstrap:24:0)
  at fn(file: app/webpack:/test-app/webpack/runtime/hot module replacement:62:0)
  at ./node_modules/react-native-auth0/src/webauth/agent.js(file: app/webpack:/test-app/node_modules/react-native-auth0/src/webauth/agent.js:1:0)
  at __webpack_require__(file: app/webpack:/test-app/webpack/bootstrap:24:0)
  at fn(file: app/webpack:/test-app/webpack/runtime/hot module replacement:62:0)
  at ./node_modules/react-native-auth0/src/webauth/index.js(file: app/webpack:/test-app/node_modules/react-native-auth0/src/webauth/index.js:1:0)
  at __webpack_require__(file: app/webpack:/test-app/webpack/bootstrap:24:0)
  at fn(file: app/webpack:/test-app/webpack/runtime/hot module replacement:62:0)
  at ./node_modules/react-native-auth0/index.js(file:///app/vendor.js:<…>

Steps to reproduce

  1. ns clean
  2. ns run ios
  3. See above error
  4. ctrl-c to exit
  5. ns run ios
  6. App runs without error
bretep commented 1 year ago

I don't think this has anything to do with the react-native-auth0 package. Here is the same error with react-native-purchases

After the first build and run, subsequent runs build and run fine. However, when distributing the package on iOS, the app crashes on every launch, but no logs are emitted. I only see this log in development.

Project successfully built.
Build time: 31.628 s.
The build result is located at: /Volumes/Development/test-app/platforms/ios/build/Debug-iphonesimulator/testapp.app
Installing on device F3C7587C-166D-48BA-92F0-085892E2FC86...
Successfully installed on device with identifier 'F3C7587C-166D-48BA-92F0-085892E2FC86'.
Successfully transferred all files on device F3C7587C-166D-48BA-92F0-085892E2FC86.
Restarting application on device F3C7587C-166D-48BA-92F0-085892E2FC86...
  ***** Fatal JavaScript exception - application has been terminated. *****
  NativeScript encountered a fatal error: Uncaught Error: `new NativeEventEmitter()` requires a non-null argument.
  at
  NativeEventEmitter(file: app/webpack:/test-app/node_modules/@open-native/core/Libraries/EventEmitter/NativeEventEmitter.js:25:0)
  at _Linking(file: app/webpack:/test-app/node_modules/@open-native/core/Libraries/Linking/Linking.js:23:0)
  at ./node_modules/@open-native/core/Libraries/Linking/Linking.js(file: app/webpack:/test-app/node_modules/@open-native/core/Libraries/Linking/Linking.js:112:7)
  at __webpack_require__(file: app/webpack:/test-app/webpack/bootstrap:24:0)
  at fn(file: app/webpack:/test-app/webpack/runtime/hot module replacement:62:0)
  at ./node_modules/@open-native/core/index.ios.js(file:///app/vendor.js:49237:84)
  at __webpack_require__(file: app/webpack:/test-app/webpack/bootstrap:24:0)
  at fn(file: app/webpack:/test-app/webpack/runtime/hot module replacement:62:0)
  at ./node_modules/react-native-purchases/dist/purchases.js(file: app/webpack:/test-app/node_modules/react-native-purchases/dist/purchases.js:40:21)
  at __webpack_require__(file: app/webpack:/test-app/webpack/bootstrap:24:0)
  at fn(file: app/webpack:/test-app/webpack/runtime/hot module replacement:62:0)
  at ./node_modules/react-native-purchases/dist/index.js(file: app/webpack:/test-app/node_modules/react-native-purchases/dist/index.js:16:34)
  at __webpack_require__(file: app/webpack:/test-app/webpack/bootstrap:24:0)
  at fn(file: app/webpack:/test-app/webpack/runtime/hot module replacement:62:0)
  at ./app/stores/revenuecat.js(file:///app/bundle.js:840:80)
  at __web<…>