【问题标题】:Updated React Native, can't find 'boost' dependency in Podfile更新了 React Native,在 Podfile 中找不到“boost”依赖项
【发布时间】:2021-11-24 05:04:21
【问题描述】:

正如我的问题标题中提到的,我在更新到 React Native 0.66 后尝试运行 pod install,但我不断收到以下错误:

[!] CocoaPods could not find compatible versions for pod "boost":
  In Podfile:
    RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) was resolved to 2021.06.28.00-v2, which depends on
      boost

    React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) was resolved to 0.66.0, which depends on
      boost (= 1.76.0)

Specs satisfying the `boost (= 1.76.0), boost` dependency were found, but they required a higher minimum deployment target.

我已经搜索了另一个引用“提升”的问题的高低,但我无法在任何地方找到它。我已经安装了boost-for-react-native 并添加到我的 Podfile 中,但它似乎没有解决任何问题。

如果我将 Podfile 中的部署目标更改为 11.0 甚至 14.0,我仍然会收到错误消息。

这完全阻止了我的项目的构建,所以如果我能得到任何帮助,那就太好了。

完整的 Pod 文件如下:

platform :ios, '11.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'manager' do
  # Pods for manager
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/React/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'RCT-Folly', :podspec => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec'

  pod 'React-perflogger', :path => '../node_modules/react-native/ReactCommon/reactperflogger'
  pod 'React-runtimeexecutor', :path => '../node_modules/react-native/ReactCommon/runtimeexecutor'
  pod 'boost-for-react-native', :podspec => 'https://raw.githubusercontent.com/react-native-community/boost-for-react-native/master/boost-for-react-native.podspec'


  # pod 'RNExtractColor', :path => '../node_modules/react-native-extract-color'

  # pod 'react-native-webview', :path => '../node_modules/react-native-webview'

  # pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'

  # pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

  # pod 'react-native-view-shot', :path => '../node_modules/react-native-view-shot'

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

  use_native_modules!
end

target 'manager-tvOS' do
  # Pods for manager-tvOS

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

end

post_install do |installer|
  ## Fix for XCode 12.5 beta
  find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
  "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")

  installer.pods_project.targets.each do |target|

    # The following is needed to ensure the "archive" step works in XCode.
    # It removes React & Yoga from the Pods project, as it is already included in the main project.
    # Without this, you'd see errors when you archive like:
    # "Multiple commands produce ... libReact.a"
    # "Multiple commands produce ... libyoga.a"

    targets_to_ignore = %w(React yoga)
    
    if targets_to_ignore.include? target.name
      target.remove_from_project
    end

  end
end

def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end

【问题讨论】:

    标签: xcode react-native cocoapods


    【解决方案1】:

    当我升级到 react-native 0.66.4 时,我遇到了同样的问题。从字面上得到确切的错误消息。

    我的 Podfile 中缺少以下行:

    pod 'boost', :podspec => '../node_modules/react-native/third-party-podspecs/boost.podspec'
    

    添加后,我运行pod install 并解决了问题!

    【讨论】:

      【解决方案2】:

      我最近在更新 react native 后遇到了类似的 boost 问题。在恐慌消退并喝了一杯好咖啡后,我能够通过以下方式解决:

      1. 在 Xcode 中打开 &lt;app_name&gt;/ios/&lt;app_name&gt;.xcworkspace 文件。
      2. 提高 iOS 部署目标(在我的例子中,我只达到了 10 个)。
      3. 产品 > 清理构建文件夹,然后产品 > 运行。
      4. 在问题导航器中找到 boost 错误,并确定错误在哪个 pod 下列出(在我的例子中是 RNReanimated)。
      5. 更新与 pod 相关的 node 包(在我的例子中,npm update react-native-reanimated
      6. 最后,运行pod install

      执行这些步骤后,我能够让我的项目重新启动并运行。

      【讨论】:

        猜你喜欢
        • 2022-10-31
        • 2017-10-10
        • 1970-01-01
        • 2019-10-02
        • 2020-10-28
        • 2020-06-08
        • 2021-01-21
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多