首页 > 解决方案 > 找不到“EXUpdates/EXUpdatesAppController.h”文件

问题描述

我有一个名为“MyReactNative”的反应原生项目。我已经更新了 react native 版本(~0.63.3),之后在运行 iOS 代码时出现以下错误:

找不到“EXUpdates/EXUpdatesAppController.h”文件

这就是我的 package.json 的样子:

{
  "main": "index.js",
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "start": "react-native start",
    "test": "jest",
    "build:ios": "node node_modules/react-native/local-cli/cli.js bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'"
  },
  "dependencies": {
    "@react-native-community/cli-platform-android": "^4.13.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/native": "^5.8.10",
    "@react-navigation/stack": "^5.12.8",
    "axios": "^0.19.0",
    "babel-preset-react-native": "5.0.2",
    "local_package": "file:../local_package-1.6.0.tgz",
    "expo": "~39.0.2",
    "expo-splash-screen": "~0.6.2",
    "expo-status-bar": "~1.0.2",
    "expo-updates": "^0.3.5",
    "nodemon": "^1.18.10",
    "npm-install-peers": "^1.2.1",
    "prop-types": "^15.6.0",
    "react": "17.0.1",
    "react-devtools": "^3.6.1",
    "react-dom": "16.13.1",
    "react-native": "~0.63.3",
    "react-native-axios": "^0.17.1",
    "react-native-easy-toast": "^1.2.0",
    "react-native-enhanced-popup-menu": "^0.6.1",
    "react-native-gesture-handler": "^1.7.0",
    "react-native-reanimated": "^1.13.2",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.10.1",
    "react-native-unimodules": "~0.11.0",
    "react-native-web": "~0.13.12",
    "underscore": "^1.9.1"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "babel-jest": "~25.2.6",
    "jest": "~25.2.6",
    "react-test-renderer": "~16.13.1"
  },
  "jest": {
    "preset": "react-native"
  },
  "private": true
}

和 podfile 看起来像:

# Uncomment the next line to define a global platform for your project
# platform :ios, '10.0'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'MyReactNative' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
 
  config = use_native_modules!
  use_react_native!(:path => config["../node_modules/react-native"]) 
end

我尝试了互联网上给出的解决方案,如下所示:

反应原生 ios 构建失败并出现错误 - 找不到“EXUpdates/EXUpdatesAppController.h”文件

https://docs.expo.io/bare/installing-updates/

还尝试重新安装节点模块和 pod。不幸的是,没有什么对我有用。请帮忙!

标签: iosreact-nativeexponode-modules

解决方案


在对 podfile 进行以下更改后,我可以运行我的项目:(添加了 use_unimodules!)

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'MyReactNative' do
  #use_frameworks!
  use_unimodules!
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])
  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  #use_flipper!
  #post_install do |installer|
   # flipper_post_install(installer)
  #end
end

再次运行 pod install。


推荐阅读