React Native iOS构建报错:找不到'react/renderer/graphics/Float.h'文件
React Native 0.73.3 + Xcode 13.4.1 构建时RNReanimated报头文件找不到错误
环境信息
- Xcode:13.4.1
- React Native:0.73.3
- react-native-reanimated版本:^2.2.0
错误详情
构建项目时出现如下编译错误:
Lexical or Preprocessor Issue:'react/renderer/graphics/Float.h' file not found. Pods > Development Pods > React-Fabric > core > ComponentDescriptor.h
注释该行代码后,会出现其他.h文件找不到的错误,推测存在路径缺失,但不清楚具体缺失哪些路径。
已做的修改
1. Podfile修改内容
require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' # Resolve react_native_pods.rb with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "react-native/scripts/react_native_pods.rb", {paths: [process.argv[1]]}, )', __dir__]).strip platform :ios, '13.4' prepare_react_native_project! install! 'cocoapods', :deterministic_uuids => false linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end target 'MyApplication' do config = use_native_modules! # Flags change depending on the env values. flags = get_default_flags() use_react_native!( :path => config[:reactNativePath], # Hermes is now enabled by default. Disable by setting this flag to false. # Upcoming versions of React Native may rely on get_default_flags(), but # we make it explicit here to aid in the React Native upgrade process. :hermes_enabled => true, :fabric_enabled => flags[:fabric_enabled], # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. :flipper_configuration => FlipperConfiguration.enabled, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) pod 'RNFS', :path => '../node_modules/react-native-fs' pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo' pod 'Firebase', :modular_headers => true pod 'FirebaseCoreInternal', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true pod 'FirebaseCore', :modular_headers => true target 'MyApplicationTests' do inherit! :complete # Pods for testing end post_install do |installer| # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false, # :ccache_enabled => true ) end end
2. 项目package.json内容
{ "name": "myapplication", "version": "1.6.3", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", "postinstall": "patch-package" }, "dependencies": { "@react-native-community/cli": "^13.6.6", "@react-native-community/datetimepicker": "^3.5.2", "@react-native-community/masked-view": "^0.1.11", "@react-native-community/netinfo": "^6.1.0", "@react-native-community/progress-bar-android": "^1.0.4", "@react-native-community/progress-view": "^1.3.1", "@react-native-firebase/app": "^18.8.0", "@react-native-firebase/messaging": "^18.8.0", "@react-native-picker/picker": "^1.16.5", "@react-native/metro-config": "^0.74.81", "@react-navigation/bottom-tabs": "^6.0.1", "@react-navigation/native": "^6.0.1", "@react-navigation/stack": "^6.0.1", "@types/react": "^17", "axios": "^1.6.7", "deprecated-react-native-prop-types": "^2.3.0", "patch-package": "^6.4.7", "postinstall-postinstall": "^2.1.0", "react": "18.2.0", "react-native": "0.73.3", "react-native-autocomplete-dropdown": "1.1.6", "react-native-barcode-mask": "^1.2.4", "react-native-blob-util": "^0.16.2", "react-native-bottomsheet": "^2.5.2", "react-native-bouncy-checkbox": "^2.1.3", "react-native-camera": "^4.2.1", "react-native-eject": "^0.1.2", "react-native-file-viewer": "^2.1.4", "react-native-fs": "^2.18.0", "react-native-gesture-handler": "^1.10.3", "react-native-gradle-plugin": "^0.71.19", "react-native-image-pan-zoom": "^2.1.12", "react-native-mmkv": "^2.12.2", "react-native-paper": "^4.9.2", "react-native-pdf": "^6.6.0", "react-native-picker-select": "^8.0.4", "react-native-raw-bottom-sheet": "^2.2.0", "react-native-reanimated": "^2.2.0", "react-native-render-html": "^6.0.5", "react-native-safe-area-context": "^3.3.0", "react-native-screens": "^3.5.0", "react-native-splash-screen": "^3.2.0", "react-native-swipe-list-view": "^3.2.9", "react-native-swiper": "^1.6.0", "react-native-toast-message": "^1.4.9", "react-native-vector-icons": "9.2.0", "react-native-webview": "^11.6.6", "react-native-zip-archive": "^6.0.3", "rn-fetch-blob": "^0.12.0", "yarn": "^1.22.19" }, "devDependencies": { "@babel/core": "^7.15.0", "@babel/runtime": "^7.14.8", "@react-native-community/eslint-config": "^3.0.0", "@types/jest": "^26.0.24", "@types/react-native": "^0.64.12", "@types/react-native-vector-icons": "^6.4.8", "@types/react-test-renderer": "^17.0.1", "babel-jest": "^27.0.6", "eslint": "^7.32.0", "jest": "^27.0.6", "metro-config": "^0.80.5", "metro-react-native-babel-preset": "^0.72.1", "react-test-renderer": "^18.2.0", "typescript": "^4.3.5", "yarn-upgrade-all": "^0.5.4" }, "resolutions": { "@types/react": "^17" }, "jest": { "preset": "react-native", "moduleFileExtensions": [ "ts", "tsx", "js", "jsx", "json", "node" ] }, "description": "My custom App", "main": "index.js", "repository": "", "author": "author", "license": "Private" }
3. RNReanimated.podspec修改内容
已修改该文件设置C++编译器版本,新增了CLANG_CXX_LANGUAGE_STANDARD配置:
s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" ", "FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes\"", "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", # 新增该行 }
如需其他文件信息来解决该问题,请告知。
内容的提问来源于stack exchange,提问作者briast
相关产品推荐
相关产品推荐

