Native Module cannot be null when using react-native-purchases

Viewed 133

Trying to run an expo react native project w/ revenue cat integration. Whenever I had the react-native-pruchases library downloaded though, I continue to get this error.

Invariant Violation: Native module cannot be null

I downloaded the library by running npm install react-native-purchases --save, I didn't do any of the additional iOS setup the docs outlined. I've been going crazy over this so some help is appreciated.

package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/datetimepicker": "4.0.0",
    "@react-native-community/slider": "4.1.12",
    "@react-navigation/bottom-tabs": "^6.2.0",
    "@react-navigation/native-stack": "^6.4.0",
    "dotenv": "^16.0.0",
    "expo": "~44.0.0",
    "expo-av": "~10.2.0",
    "expo-linear-gradient": "~11.0.3",
    "expo-status-bar": "~1.2.0",
    "firebase": "^9.6.5",
    "jest": "26.6.3",
    "jest-expo": "^44.0.1",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-circular-progress": "^1.3.7",
    "react-native-countdown-circle-timer": "^3.0.9",
    "react-native-modal": "^13.0.1",
    "react-native-purchases": "^4.6.0",
    "react-native-safe-area-context": "3.3.2",
    "react-native-screens": "~3.10.1",
    "react-native-web": "0.17.1",
    "uuid": "^3.4.0",
    "victory-native": "^36.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/jest": "^27.4.0",
    "@types/react": "~17.0.21",
    "@types/react-native": "~0.64.12",
    "react-test-renderer": "^17.0.2",
    "typescript": "~4.3.5"
  },
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [
      "node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)"
    ]
  },
  "private": true
}


1 Answers

This error message occurs when trying to use a native module when debugging on the expo go app. The module should work in the standalone app.

You can find other ways to debug with the native modules here https://docs.expo.dev/build/internal-distribution/

Related