javascript - 更新到 sdk 34 expo 后, "ExpoNativeModulesProxy" native 模块未通过 NativeModules 错误导出

标签 javascript reactjs react-native expo

最近,我更新了我的 React Native Expo 应用程序以使用 Expo sdk 34,但收到此错误:“ExpoNativeModulesProxy” native 模块未通过 NativeModules 导出;验证expo-react-native-adapter的 native 代码是否正确链接

我用过 code-mod该博览会在 their upgrading to sdk 34 docs 中建议,我已经更新了我的 expo-cli、node 版本,并从使用 npm 切换到了yarn,但无论我尝试什么,我仍然看到此错误。

我正在使用这个环境:

  Expo CLI 3.0.9 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 12.8.0 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.10.3 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5692245
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^34.0.1 => 34.0.4
      react: 16.8.3 => 16.8.3
      react-native: https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz => 0.59.8
      react-navigation: ^2.18.2 => 2.18.3
    npmGlobalPackages:
      expo-cli: 3.0.9

在我的 app.json 中,我使用 {"sdkVersion": "34.0.0"} ,我的 package.json 看起来像这个:

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "node ./node_modules/jest/bin/jest.js --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@babel/plugin-proposal-decorators": "^7.4.4",
    "@expo/samples": "2.1.1",
    "@expo/vector-icons": "^10.0.0",
    "@fortawesome/free-brands-svg-icons": "^5.10.1",
    "@fortawesome/pro-light-svg-icons": "^5.10.1",
    "@fortawesome/pro-regular-svg-icons": "^5.10.1",
    "@fortawesome/pro-solid-svg-icons": "^5.10.1",
    "adm-zip": "^0.4.13",
    "babel-plugin-react-native-classname-to-style": "^1.2.2",
    "babel-plugin-react-native-platform-specific-extensions": "^1.1.1",
    "expo": "^34.0.1",
    "expo-asset": "~6.0.0",
    "expo-codemod": "^1.0.6",
    "expo-constants": "6.0.0",
    "expo-core": "^3.0.1",
    "expo-facebook": "^6.0.0",
    "expo-file-system": "~6.0.0",
    "expo-font": "^6.0.1",
    "expo-localization": "^6.0.0",
    "expo-react-native-adapter": "^3.0.1",
    "expo-web-browser": "6.0.0",
    "fastfall": "^1.5.1",
    "har-validator": "^5.1.3",
    "i18n-js": "^3.3.0",
    "i18next-conv": "^9.1.0",
    "jsc-android": "^236355.1.1",
    "lodash": "^4.17.15",
    "mobx": "^5.13.0",
    "mobx-react": "^5.4.4",
    "moment": "^2.24.0",
    "moment-timezone": "^0.5.26",
    "native-base": "^2.13.4",
    "plist": "^3.0.1",
    "progress": "^2.0.3",
    "react": "16.8.3",
    "react-currency-formatter": "^1.1.0",
    "react-dom": "^16.8.6",
    "react-i18next": "^10.11.5",
    "react-moment": "^0.8.4",
    "react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
    "react-native-actionsheet": "^2.4.2",
    "react-native-collapsible": "^1.5.1",
    "react-native-config": "^0.11.7",
    "react-native-fontawesome-pro": "^2.1.0",
    "react-native-geocoding": "^0.3.0",
    "react-native-gesture-handler": "^1.3.0",
    "react-native-google-places-autocomplete": "^1.3.9",
    "react-native-loading-spinner-overlay": "^1.0.1",
    "react-native-maps": "^0.24.0",
    "react-native-modal-datetime-picker": "^6.1.0",
    "react-native-numeric-input": "^1.8.3",
    "react-native-picker-select": "^6.3.0",
    "react-native-router-flux": "^4.0.6",
    "react-native-svg": "~9.5.1",
    "react-native-svg-animated-linear-gradient": "^0.3.2",
    "react-native-web": "^0.11.4",
    "react-native-webview-messaging": "^1.2.3",
    "react-navigation": "^2.18.2",
    "react-redux": "^6.0.1",
    "redux": "^4.0.4",
    "rn-webview": "^0.1.0",
    "validator": "^10.11.0",
    "validatorjs": "^3.15.1",
    "xcode": "^1.1.0"
  },
  "devDependencies": {
    "@babel/plugin-proposal-decorators": "^7.4.4",
    "babel-jest": "^23.6.0",
    "babel-preset-expo": "^6.0.0",
    "babel-preset-react-native": "^5.0.2",
    "jest-expo": "^34.0.0",
    "metro": "^0.55.0",
    "metro-bundler": "^0.22.1",
    "metro-react-native-babel-preset": "^0.51.1",
    "node-sass": "^4.12.0",
    "react-native-sass-transformer": "^1.4.0",
    "react-native-typed-sass-transformer": "^0.11.0",
    "react-test-renderer": "^16.8.6"
  },
  "private": true
}

为了升级到 expo sdk 34.0,我使用了 release docs 中的 Expo 说明。 。我做错了什么可能会导致这个问题吗?如果我 checkout 到没有新 sdk 的分支,我不会看到此错误。

最佳答案

我认为这是一个设置问题。

您已将 Expo 版本从 ^34.0.1 更改为 ^34.0.4

但它没有改变,它在您的 package.json 文件中。我认为我们需要对此进行修改。

  1. rm -rf 节点模块
  2. "expo": "^34.0.1"=> "expo": "^34.0.4" 更改为 package.json
  3. yarn installnpm install
  4. expo start -c

关于javascript - 更新到 sdk 34 expo 后, "ExpoNativeModulesProxy" native 模块未通过 NativeModules 错误导出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57516445/

相关文章:

javascript - onClick 处理程序不会等待单击,而是立即打印所有信息

node.js - React 脚本无法编译

javascript - 可能未处理的 promise 拒绝 ID : Invalid FCM Event subscription

react-native - 在 Realm React Native 的架构中找不到对象类型 'ShortAnswer'

javascript - 添加了一个CSS背景,如何完全删除它

javascript - nodejs无法用momentjs解析日期

javascript - 在所有 slideDowns/slideUps 完成后执行一个函数

javascript - API 调用在 React 组件内返回 promise 而不是数据

android - ListView 的 onEndReached,在 native react 中,没有按预期工作

javascript - jQuery 数据表 : Use button to filter rows on all pages?