React Native upgrade from 0.50.4 to 0.55.3 giving no such file or directory Yoga.c error

1.7k Views Asked by At

I am upgrading my react native project from 0.50.4 to o.55.3(latest). After updating after npm install I am getting error as below.

No such file or directory: '{PATH}/node_modules/reactnative/ReactCommon/yoga/yoga/Yoga.c'

I checked the file directory and found out that projects which use react native version above 0.52.0 have different files yoga directory. Please check the images.(first one is <0.52.0, second one is >=0.52.0)

Before 0.52.0 After 0.52.0 How to fix the problem of can't find file Yoga.c in latest react native version?

Note: I cleaned, re installed npm modules, removed build in IOS folder and tried... nothing worked.

EDIT podfile

# Uncomment the next line to define a global platform for your project
 platform :ios, ‘9.0’

target 'ProjectName' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  #use_frameworks!

  # Pods for ProjectName

pod 'Fabric'
pod 'Crashlytics'
pod 'RSKImageCropper'
pod 'QBImagePickerController'
pod 'FreshchatSDK'
pod 'Mixpanel'

pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'BatchedBridge'
]

   pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  # pod 'react-native-sqlite-storage', :path => '../node_modules/react-native-sqlite-storage'



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

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

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

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

end
1

There are 1 best solutions below

4
On BEST ANSWER

Can you please update you Podfile including below lines, please remove current yoga pod spec. Below is for your reference, include your existing dependencies as well.

target 'Demo' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for Demo

  rn_path = '../node_modules/react-native'

  pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"


pod 'React', path: rn_path, subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ]


  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

end

Do pod install again, Clean build, delete Derived Data and run iOS code from Xcode.