Search code examples
xcodereact-nativecocoapods

Updated React Native, can't find 'boost' dependency in Podfile


As mentioned in my question title, I'm trying to run pod install following an update to React Native 0.66, and I keep getting the following error:

[!] 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.

I've searched high-and-low for another issue referencing 'boost', but I can't find it anywhere. I've installed boost-for-react-native and added to my Podfile, but it doesn't seem to fix anything.

If I change my deployment target in the Podfile to 11.0 or even 14.0, I still get the error.

This has totally stopped my project from building, so if I can get any kind of help that would be great.

Full Podfile below:

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

Solution

  • I had the same issue when I upgraded to react-native 0.66.4. Literally getting the exact error message.

    I was missing the following line in my Podfile:

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

    Once I added that, I ran pod install and the problem was resolved!