RN pod install 失败(could not find compatible versions for pod “React/Core“)

使用最新版本 React-Native(0.63) 准备嵌入原生项目时, 按照官网教程集成到现有原生项目, 一步一个脚印, 到 pod install 出现如下错误

[!] CocoaPods could not find compatible versions for pod "React/Core":
In Podfile:
React/Core (from `../node_modules/react-native`)

None of your spec sources contain a spec satisfying the dependency: `React/Core (from `../node_modules/react-native`)`.

You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.

最后的最后发现时 Podfile 的写法需要替换了,不同版本有不同写法。

在官方 github/template/ios/Podfile 寻找对应版本的 Podfile 写法。就可以 pod install成功了。比如0.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 'HelloWorld' do
  config = use_native_modules!

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

  target 'HelloWorldTests' 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 'HelloWorld-tvOS' do
  # Pods for HelloWorld-tvOS

  target 'HelloWorld-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值