首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当使用react本地购买时,本机模块不能为空。

当使用react本地购买时,本机模块不能为空。
EN

Stack Overflow用户
提问于 2022-06-27 13:17:13
回答 1查看 262关注 0票数 1

试图运行一个世博反应本地项目w/收益猫集成。但是,每当我下载了react-native-pruchases库时,我就会继续得到这个错误。

Invariant Violation: Native module cannot be null

我通过运行npm install react-native-purchases --save下载了库,没有做任何附加的iOS设置了概述的文档。我为这件事发疯了,所以我们很感谢你的帮助。

package.json

代码语言:javascript
复制
{
  "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
}
EN

回答 1

Stack Overflow用户

发布于 2022-06-29 05:28:48

当在expo应用程序上调试时,尝试使用本机模块时会出现此错误消息。模块应该在独立应用程序中工作。

您可以在这里找到使用本机模块进行调试的其他方法-- https://docs.expo.dev/build/internal-distribution/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72772786

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档