React-native: CocoaPods resolver with conflicting yoga versions

Created on 20 May 2018  路  3Comments  路  Source: facebook/react-native

Environment

Environment:
OS: macOS High Sierra 10.13.4
Node: 8.11.1
Yarn: 1.6.0
npm: 5.6.0
Watchman: Not Found
Xcode: Xcode 9.3.1 Build version 9E501
Android Studio: 3.1 AI-173.4720617

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.3 => 0.55.3

Steps to Reproduce

  1. Install cocoapods, here is my Gemfile:
source "https://rubygems.org"
ruby ">=2.4"
gem "fastlane"
gem "pry"
gem "cocoapods"
  1. Configure your Podfile in the ios folder, here is mine:
platform :ios, '8.0'

target 'PoolOfficeManager' do
  # this is very important to have!
  rn_path = '../node_modules/react-native'
  pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: rn_path, subspecs: [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]

  pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'

end

# very important to have, unless you removed React dependencies for Libraries 
# and you rely on Cocoapods to manage it
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end
  1. From the ios folder, run pod install

Expected Behavior

It should successfully install all the pods.

Actual Behavior

It fails with the following error:

[!] CocoaPods could not find compatible versions for pod "yoga":
  In snapshot (Podfile.lock):
    yoga (from `../node_modules/react-native/ReactCommon/yoga/yoga.podspec`)

  In Podfile:
    yoga (from `../node_modules/react-native/ReactCommon/yoga/yoga.podspec`)

Due to the previous na茂ve CocoaPods resolver, you were using a pre-release version of `yoga`, without explicitly asking for a pre-release version, which now leads to a conflict. Please decide to either use that pre-release version by adding the version requirement to your Podfile (e.g. `pod 'yoga', '= 0.55.4.React'`) or revert to a stable version by running `pod update yoga`.

If I try pod update yoga I get the following error:

[!] CocoaPods could not find compatible versions for pod "React/RCTVibration":
  In snapshot (Podfile.lock):
    React/RCTVibration (from `../node_modules/react-native`)

  In Podfile:
    React/RCTVibration (from `../node_modules/react-native`)

It seems like you've changed the constraints of dependency `React/RCTVibration` inside your development pod `React/RCTVibration`.
You should run `pod update React/RCTVibration` to apply changes you've made.
Locked

Most helpful comment

I was updating react native and was trying to run pod install like above, and got that error. All I had to do was run pod update instead.

All 3 comments

Not sure how, but I had mismatch versions between react on package.json (0.55.3) and on the Podfile.lock (0.55.4). And it seems to be related with the issue I was having.

I was updating react native and was trying to run pod install like above, and got that error. All I had to do was run pod update instead.

the error says

[!] CocoaPods could not find compatible versions for pod "yoga":
In Podfile:
yoga (from ../node_modules/react-native/ReactCommon/yoga/yoga.podspec)

Specs satisfying the yoga (from../node_modules/react-native/ReactCommon/yoga/yoga.podspec) dependency were found, but they required a higher minimum deployment target.

what i had to do is upgrading the deployment target of my project from 8 to 9
and that solved the issue

Was this page helpful?
0 / 5 - 0 ratings