Edgar Gallegos
Edgar Gallegos

Reputation: 11

Invariant Violation: `new NativeEventEmitter()` requires a non-null argument., js engine: hermes


// No problem at all with this code
import {View, Text} from 'react-native'
const App = () => {
    return (
        <View>
            <Text>
                Test
            </Text>
        </View>
    )
}

export default App

OUTPUT: LOG  Running "Chat" with {"rootTag":161,"initialProps":{}}
info Reloading app...
 BUNDLE  ./index.js 

********************************************

// but as soon as I import

import {View, Text} from 'react-native'
import {Voximplant} from 'react-native-voximplant';  <--

const client = Voximplant.getInstance();   <--

const App = () => {
    
    return (
        <View>
            <Text>
                Test
            </Text>
        </View>
    )
}

export default App


// I get the following.
OUTPUT: LOG  Running "Chat" with {"rootTag":171,"initialProps":{}}
 ERROR  Invariant Violation: `new NativeEventEmitter()` requires a non-null argument., js engine: hermes


I have try all the latest answers on GitHub and stack overflow but none of them work. At this point I don't know what to do. Do to this problem I am not able to use Voximplant.

{ "name": "Chat", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest" }, "dependencies": { "react": "18.2.0", "react-native": "0.71.5", "react-native-voximplant": "^1.36.0" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native-community/eslint-config": "^3.2.0", "@tsconfig/react-native": "^2.0.2", "@types/jest": "^29.2.1", "@types/react": "^18.0.24", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.2.1", "eslint": "^8.19.0", "jest": "^29.2.1", "metro-react-native-babel-preset": "0.73.9", "prettier": "^2.4.1", "react-test-renderer": "18.2.0", "typescript": "4.8.4" }, "jest": { "preset": "react-native" } }

Currently running on MacBook Pro M2, OS: macOs Ventura Version 13.3

Upvotes: 1

Views: 1197

Answers (1)

KimioN42
KimioN42

Reputation: 647

Just to make sure, did you run pod install in your ios folder after adding the new module?

That looks like an error when you install a new module but don't generate the pods for the iOS development.

Steps:

  1. Navigate to your ios folder within your react-native project.

  2. run pod install from the terminal.

  3. On Xcode, clean your project by using the shortcut cmd+shift+k. (Pro tip: you can delete the Derived Data folder within ~/Library/Developer/XCode/DerivedData, it will be generated again once you successfully build your app).

  4. Build your app (cmd+r);

Upvotes: 0

Related Questions