首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“‘folly/Portability.h”文件未找到React库

“‘folly/Portability.h”文件未找到React库
EN

Stack Overflow用户
提问于 2019-07-23 13:26:30
回答 3查看 4.8K关注 0票数 5

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

在过去的几天里,我一直试图自己解决这个问题,但无法解决。

RN信息:

代码语言:javascript
复制
  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

podfile

代码语言:javascript
复制
# 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

尝试移除荚文件夹并重新安装它们,并删除节点模块文件夹。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2019-08-29 11:24:16

将以下内容添加到Podfile中的target 'WhosThat_app' do

代码语言:javascript
复制
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

我不需要下面的一行,相信您可以删除它:

代码语言:javascript
复制
pod 'Folly', podspec: '../node_modules/react-native/third-party-podspecs/Folly.podspec'

Notes

票数 3
EN

Stack Overflow用户

发布于 2020-01-08 10:53:38

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

1)添加CxxBridge子规范

2) Point DoubleConversionglog依赖项直接用于Folly

Podfile示例:

代码语言:javascript
复制
# 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"
票数 0
EN

Stack Overflow用户

发布于 2020-05-27 10:43:41

代码语言:javascript
复制
pod 'React', path: rn_path, subspecs: [
  'ART',
  'Core',
  'CxxBridge',
  'RCTText',
  'RCTNetwork',
  'RCTLinkingIOS',
  'RCTImage',
  'RCTAnimation',
  'RCTWebSocket', # needed for debugging
  'RCTActionSheet',
  'RCTGeolocation',
  'RCTSettings',
  'RCTVibration',
  'DevSupport',
  'RCTPushNotification'
]

通过添加这些内容,我的问题得到了成功的解决。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57165232

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档