React-Native:错误:无法为 iOS 项目安装 CocoaPods 依赖项,这是此模板所必需的 [英] React-Native: Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template
问题描述
在执行 npx react-native init MyProject
时,我遇到了以下错误:
While executing npx react-native init MyProject
I ran into the following error:
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
这似乎与之前显示的错误有关:
Which seems to be related to an earlier error displayed:
checking for arm-apple-darwin-gcc... /Library/Developer/CommandLineTools/usr/bin/cc -arch armv7 -isysroot
checking whether the C compiler works... no
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
XCode 及其 CLI 似乎都运行良好.
XCode and its CLI seem to all run fine.
我的配置:
- MacOS Catalina 10.15.1 (19B88)
- NPM 6.11.3
- 反应原生 0.61.4
- XCode 11.2.1 (11B500)
感谢任何线索.
推荐答案
I've found a very similar error reported here, with a solution that suggested:
sudo xcode-select --switch /Applications/Xcode.app
阅读 似乎表明在更新线的某个地方,XCode CLI 工具路径设置为不正确的路径.
Reading around seems to suggest that somewhere down the updates line, the XCode CLI tools path was set to an incorrect one.
正如@bibin-jaimon 在下面的评论中所建议的那样,我的机器上确实有多个版本的 XCode(为什么?因为 https://stackoverflow.com/a/58329901/606351).
Also as @bibin-jaimon suggested in the comments below, I do have multiple versions of XCode on my machine (why? because of https://stackoverflow.com/a/58329901/606351).
总之,问题解决了.
这篇关于React-Native:错误:无法为 iOS 项目安装 CocoaPods 依赖项,这是此模板所必需的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!