【问题标题】:The "ExpoNativeModulesProxy" native module is not exported through NativeModules error after updating to sdk 34 expo更新到 sdk 34 expo 后,“ExpoNativeModulesProxy”原生模块未通过 NativeModules 错误导出
【发布时间】:2025-11-30 12:35:01
【问题描述】:

最近,我更新了我的 react 原生 Expo 应用程序以使用 Expo sdk 34,我收到此错误:The "ExpoNativeModulesProxy" native module is not exported through NativeModules; verify that expo-react-native-adapter's native code is linked properly

我已经使用了 expo 在 their upgrading to sdk 34 docs 中建议的 code-mod,我已经更新了我的 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 说明。我做错了什么可能会导致这个问题吗?如果我结帐到没有新 sdk 的分支,我不会看到此错误。

【问题讨论】:

标签: javascript reactjs react-native expo


【解决方案1】:

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

您已经将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

【讨论】:

  • 我尝试将sdkVersionexpo 版本都更新为34.0.4,就像你提到的那样,但我得到了一个不同的错误:Warning: Problem validating app.json: Unable to perform cache refresh for /Users/espinozamaria/.expo/cache/schema-34.0.4.json: Error: Request failed with status code 404. Error: Invalid sdkVersion. Valid options are 7.0.0, 8.0.0, 9.0.0, 10.0.0, 11.0.0, 12.0.0, 13.0.0, 14.0.0, 15.0.0, 16.0.0, 17.0.0, 18.0.0, 19.0.0, 20.0.0, 21.0.0, 22.0.0, 23.0.0, 24.0.0, 25.0.0, 26.0.0, 27.0.0, 28.0.0, 29.0.0, 30.0.0, 31.0.0, 32.0.0, 33.0.0, 34.0.0
  • @MariaEspinoza 对不起。这是我的错。 app.json 包含版本列表。我修改了 app.json 更改。更新了我的答案
  • 不幸的是,在您的答案中运行这些说明后,我仍然收到错误
  • 你能试试这个吗? expo install expo asset.
  • 我试过这样做,但仍然没有成功摆脱那个错误。
最近更新 更多