Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods always install old React (0.11.0)

I have a problem when I run pod install Pod always downgrade React Installing React 0.11.0 (was 0.55.4)

my pod file:

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '9.0'
project 'BunteMobile.xcodeproj'
target 'BunteMobile' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for BunteMobile
  pod 'Adjust', '~> 4.8.3'
  pod 'Google-Mobile-Ads-SDK'
  pod 'GoogleAds-IMA-iOS-SDK', '~> 3.7'
  pod 'Fabric', '~> 1.7.0'
  pod 'Crashlytics', '~>  3.9'

  pod 'lottie-ios', :path => '../node_modules/lottie-ios'

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

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

end

I read about some solution when I defined react folder from node_modules but this solution doesn't work for me too.

I put into podfile this:

pod 'yoga', path: './node_modules/react-native/ReactCommon/yoga'
pod 'React', :path => '../node_modules/react-native'

but still doesn't work. Downgrade disappear but when I try to build it, I have this error:

/node_modules/react-native/React/Base/RCTConvert.h:17:9: could not build module 'yoga'

I tried the same profile as official RN doc (https://facebook.github.io/react-native/docs/integration-with-existing-apps.html) but still same error.


Solution

I added this into my podfile:

# Pods for React-Native start
  pod 'React', :path => '../node_modules/react-native'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'

(update 2019)Solution 2 (react-native 0.61+): add this to pod file

  # Pods for React-Native start
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/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 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  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 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
like image 908
Lukáš Šálek Avatar asked Sep 06 '18 14:09

Lukáš Šálek


1 Answers

Just remove the node_modules lines from pod file and add the library manually in xCode.

I observed that when you run react-native link <someLibrary> sometimes RN automatically adds that library as pod dependency.

In my case this error showed up for react-native-webview.

To fix it:

I just removed the node_modules/react-native-webview line from the pod file and then

Added that library in xCode near the other libraries

Drag node_modules/some_library/ios/RNCWebView.xcodeproj into project library files

enter image description here

Add the library dependencies in build phases link binary with libraries

enter image description here

like image 144
Florin Dobre Avatar answered Nov 05 '22 13:11

Florin Dobre