繁体   English   中英

'folly/Portability.h' 文件未找到 React 库

[英]'folly/Portability.h' file not found React library

使用我的本机项目在 Xcode 上构建失败。 错误是'folly/Portability.h' file not found

最近几天我一直在尝试自己解决这个问题,但无法解决。

注册信息:

  React Native Environment Info:
    System:
      OS: macOS 10.14
      CPU: (4) x64 Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
      Memory: 641.79 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.6.0 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    IDEs:
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.8 => 0.59.8 
    npmGlobalPackages:
      react-native-cli: 2.0.1

播客文件

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
# Required by RNFirebase
pod 'Firebase/Core', '~> 5.20.1'

target 'WhosThat_app' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  pod 'Firebase/Firestore'
  pod 'Firebase/Storage'
  pod 'Firebase/Auth'
  pod 'GoogleMaps', '~> 2.7.0'
  pod 'Fabric', '~> 1.10.1'
  pod 'Crashlytics', '~> 3.13.1'
  # Pods for WhosThat_app
  pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
  pod 'RNBackgroundGeolocation', :path => '../node_modules/react-native-background-geolocation'
  pod 'RNBackgroundFetch', :path => '../node_modules/react-native-background-fetch'
  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
  pod 'React', :path => '../node_modules/react-native'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'Folly', podspec: '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  target 'WhosThat_app-tvOSTests' do
    inherit! :search_paths
    # Pods for testing


  end

  target 'WhosThat_appTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

尝试删除 pods 文件夹并重新安装它们并删除 node-modules 文件夹

以下添加到您的Podfile内部target 'WhosThat_app' do

target 'WhosThat_app' do

  # ...everything else

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'React'
        target.remove_from_project
      end
    end
  end

我不需要以下行,并且相信您可以将其删除:

pod 'Folly', podspec: '../node_modules/react-native/third-party-podspecs/Folly.podspec'

注意事项

要解决此问题,您应该做两件事:

1) 添加CxxBridge 子规范

2) 直接为Folly指向DoubleConversionglog依赖项规范

Podfile 示例:

# React Native
rn_path = '../node_modules/react-native'
pod 'React', path: rn_path, subspecs: [
    'CxxBridge',
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket',
    'RCTAnimation',
    'RCTActionSheet',
    'RCTGeolocation',
    'RCTImage',
    'RCTSettings',
    'RCTVibration',
    'RCTLinkingIOS'
]
pod 'yoga', :path => "#{rn_path}/ReactCommon/yoga"
pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
pod 'React', path: rn_path, subspecs: [
  'ART',
  'Core',
  'CxxBridge',
  'RCTText',
  'RCTNetwork',
  'RCTLinkingIOS',
  'RCTImage',
  'RCTAnimation',
  'RCTWebSocket', # needed for debugging
  'RCTActionSheet',
  'RCTGeolocation',
  'RCTSettings',
  'RCTVibration',
  'DevSupport',
  'RCTPushNotification'
]

通过添加这些,我的问题已成功解决。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM