CocoaPods 找不到 pod "ReactCommon/jscallinvoker" 的兼容版本:

Nud*_*dge 136 cocoapods react-native

我刚刚更新到 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`)`.
Run Code Online (Sandbox Code Playgroud)

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

Nud*_*dge 356

对于React native0.62 版本

所以我想通了

替换 Podfile 中的以下行

pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
Run Code Online (Sandbox Code Playgroud)

pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
Run Code Online (Sandbox Code Playgroud)

编辑:

如果您已更新到React Native0.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
Run Code Online (Sandbox Code Playgroud)

替换RNTodo为您自己的项目名称,cd 到终端中的 iOS 文件夹,pod install然后一切正常

另外RN0.63已下降为iOS支持9

  • 感谢您添加对 React Native 0.63 的编辑! (4认同)
  • 注意:从 Expo 中弹出的项目将显示路径为“#{rnPrefix}/ReactCommon”,因此,为了清楚起见,唯一的更改是 pod 名称中的“/jscallinvoker”为“/callinvoker” (3认同)
  • 我收到错误 `[!] Invalid 'Podfile' file: undefined method '[]' for nil:NilClass.`,但通过更改以下行来修复它:`use_react_native!(:path => config["reactNativePath"] )` 到 `use_react_native!` (2认同)

Mar*_*oli 62

我通过更改Podfilefrom 中的行解决了这个问题(版本 0.63)

pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
Run Code Online (Sandbox Code Playgroud)

pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"
Run Code Online (Sandbox Code Playgroud)


Ter*_*ius 36

我认为jscallinvoker版本已弃用尝试替换

jscallinvoker 
Run Code Online (Sandbox Code Playgroud)

callinvoker
Run Code Online (Sandbox Code Playgroud)

  • 仅供参考,这对我将 expo 更新到 38 时有用 (2认同)

小智 28

RN 0.63 不再支持 iOS 9

所以在 pod 文件中替换

  • 平台:ios,'9.0'*
  • 平台:ios,'10.0'*

  • pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
  • pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"

转到终端运行中的 ios 文件夹

  • 吊舱安装
  • 运行 react-native run-ios

  • 如果您的 Podfile 仅使用单引号,请保留单引号而不是双引号。谢谢 (2认同)

Ame*_*icA 16

升级到 React Native 0.63.0

这个问题在升级React Native到版本后发生在我的项目中,0.63.0因此对于解决方案,我只是删除Podfile.lock并删除整个Podfile并从最新版本的全新安装 React Native 项目中添加新内容,这意味着它的内容应该是:

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 '[YourProjectName]' do
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])

  target '[YourProjectName]Tests' 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 '[YourProjectName]-tvOS' do
  # Pods for [YourProjectName]-tvOS

  target '[YourProjectName]-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end
Run Code Online (Sandbox Code Playgroud)

注意很明显,您应该将项目名称替换为[YourProjectName].

之后,npx pod-install在项目的根目录上运行命令,一切都会回到正轨。

  • `[!] 在项目 `MyRNAApp.xcodeproj` 中找不到名为 `MyRNTests` 的目标,但确实找到了 `MyRNAApp`。` (3认同)

Moh*_*tif 11

如果有人仍然遇到 React Native 版本 0.63.0 的问题,那么这对我有用

更新 callinvoker pod 如下

pod 'React-callinvoker', :path => "#{rnPrefix}/ReactCommon/callinvoker"
Run Code Online (Sandbox Code Playgroud)


Tap*_*ani 9

在 RN 0.63.0 中,您可以从您那里删除所有 RN pod podfile,只需在目标中包含以下几行。

config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
Run Code Online (Sandbox Code Playgroud)

此行还需要在 开头的平台行之后添加podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
Run Code Online (Sandbox Code Playgroud)

之后,删除Pods目录Podfile.lock和工作区文件。那么就pod install.


Sha*_*yat 8

React-Native 现在正在动态配置 pod,因此您不再需要一一列出;

use_react_native!(:path => config["reactNativePath"])

这是您从 63.1 基础 Podfile 获得的内容:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'test' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  target 'testTests' do
    inherit! :complete
  end


  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'test-tvOS' do

  target 'test-tvOSTests' do
    inherit! :search_paths
  end
end
Run Code Online (Sandbox Code Playgroud)