1

我正在将我的 react native 项目从 0.50.4 升级到 o.55.3(最新)。更新后npm install我收到如下错误。

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

我检查了文件目录,发现使用 0.52.0 以上的 react native 版本的项目有不同的文件 yoga 目录。请检查图像。(第一个 <0.52.0,第二个 >=0.52.0)

0.52.0之前 0.52.0之后 如何解决最新 React Native 版本找不到文件 Yoga.c 的问题?

注意:我清理,重新安装 npm 模块,删除 IOS 文件夹中的构建并尝试......没有任何效果。

编辑播客文件

# 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
4

1 回答 1

2

您能否更新您的 Podfile,包括以下几行,请删除当前的yogapod 规范。以下供您参考,也包括您现有的依赖项。

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

再做pod install一次,清理构建,删除派生数据并从 Xcode 运行 iOS 代码。

于 2018-05-11T11:13:04.333 回答