react-native之CocoaPods 找不到 pod "ReactCommon/jscallinvoker": 的兼容版本

freeliver54 阅读:93 2025-06-02 22:19:02 评论:0

我刚刚更新到 RN v0.62 并且在 iOS 上运行应用程序给了我以下错误

!] CocoaPods could not find compatible versions for pod "ReactCommon/jscallinvoker": 
  In snapshot (Podfile.lock): 
    ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`) 
 
  In Podfile: 
    ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`) 
 
None of your spec sources contain a spec satisfying the dependency: `ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`)`. 

我删除了所有 node_modules 并做了 npm i。我也在iOS目录中安装了pod,但问题仍然存在。我也做了 pod repo 更新。

请您参考如下方法:

对于 React native 0.62 版本
所以我想通了
替换 Podfile 中的以下行

pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" 
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" 
编辑:
如果您已更新到 React Native版本 0.63
删除 Podfile.lock从 iOS 文件夹。
npm i开通 podfile从 iOS 文件夹
删除所有内容并复制以下内容
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 
require_relative '../node_modules/react-native/scripts/react_native_pods' 
 
platform :ios, '10.0' 
 
target 'RNTodo' do 
  config = use_native_modules! 
  use_react_native!(:path => config["reactNativePath"]) 
 
  target 'RNTodoTests' do 
    inherit! :complete 
    # Pods for testing 
  end 
 
  # Enables Flipper. 
  # 
  # Note that if you have use_frameworks! enabled, Flipper will not work and 
  # you should disable these next few lines. 
  use_flipper! 
  post_install do |installer| 
    flipper_post_install(installer) 
  end 
end 
 
target 'RNTodo-tvOS' do 
  # Pods for RNTodo-tvOS 
 
  target 'RNTodo-tvOSTests' do 
    inherit! :search_paths 
    # Pods for testing 
  end 
end 
替换 RNTodo使用您自己的项目名称,cd 到终端中的 iOS 文件夹并执行 pod install一切都应该有效
还有 RN 0.63 不再支持 iOS 9


标签:React
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号