mockingbot / react-native-zip-archive

Zip archive utility for react-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invariant Violation: `new NativeEventEmitter()` requires a non-null argument. | Expo

benedictpmateo opened this issue · comments

Describe the bug
When I try to use the zip function it shows this error in expo v45

Invariant Violation: `new NativeEventEmitter()` requires a non-null argument.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:39 in handleError
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules/metro-runtime/src/polyfills/require.js:203:40 in guardedLoadModule
at http://192.168.1.3:19000/src/app/index.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:244873:3 in global code

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.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:39 in handleError
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError

To Reproduce
Here's my dependencies in package.json

  "dependencies": {
    "@react-navigation/native": "^6.0.10",
    "expo": "^45.0.0",
    "expo-file-system": "~14.0.0",
    "expo-media-library": "~14.1.0",
    "expo-notifications": "~0.15.4",
    "expo-status-bar": "~1.3.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-zip-archive": "^6.0.8",
    "expo-sharing": "~10.2.0"
  }

Expected behavior
I'm currently trying to zip the files I downloaded using expo-filesystem then move the zip file to ios Sharing folder

Env (please complete the following information):

  • Device: iPhone 11
  • OS: iOS
  • OS Version: 16
  • Package Version: 6.0.8

@benedictpmateo I had this issue as well, even after a cd ios; pod install. It worked after I uninstalled the app, deleted all pods rm -rf ios/Pods/*, re-ran pod install, then re-build and run.

as per this comment, https://stackoverflow.com/questions/69538962/new-nativeeventemitter-was-called-with-a-non-null-argument-without-the-requir/69649068#69649068
in react-native-zip-archive/index.js
line 9
change const rnzaEmitter = new NativeEventEmitter(RNZipArchive);
to
const rnzaEmitter = new NativeEventEmitter();