react-native-compressor: Error after adding module and starting expo project

Current behavior

Invariant Violation: Native module cannot be null.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 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:204:6 in guardedLoadModule
at http://192.168.31.95:19000/index.bundle?platform=ios&dev=true&hot=false&minify=false:264912:3 in global code

Expected behavior

App starts

Platform

  • iOS (Android not tested)

React Native Version

Expo 44 and RN 0.64.3

React Native Compressor Version

1.5.0

Reproducible Steps And Demo

Install via yarn add or expo cli Check that the app.json has been updated with the plugin property Restart via expo start

Here is the full error message

Invariant Violation: Native module cannot be null.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 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:204:6 in guardedLoadModule
at http://192.168.31.95:19000/index.bundle?platform=ios&dev=true&hot=false&minify=false:264912: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:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError

I don’t import the library in any file If i remove the plugin property, app starts. As soon as i import the library in a component the error raises again

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

@pihomeserver @nomi9995 I use expo-dev-client and I add react-native-compressor@0.5.15 due to Expo using old RN version and I build Expo custom Client with react-native-compressor native modules embedded by Expo EAS.

@pihomeserver awesome 🔥

Ok found a solution : i upgraded cocoapods with brew and gem (i installed both) then i had an issue with fastlane (i had to install it manually), then i had an issue with EXPermission (i installed it with expo install) then i could install and deploy with eas, including the compressor package ! Still have some bugs (screen rotation is not well managed) but it works and i can call compress method !

Thank you guys !

Take look Expo founder tutorial on how to use this feature in development - https://www.youtube.com/watch?v=id0Im72UN6w

@pihomeserver could you use EAS - https://docs.expo.dev/eas/ it worked well for me and I hope it should be the same for you. We can have a 1-to-1 meeting in case you need further assistance