ios - React-Native:错误:无法为 iOS 项目安装 CocoaPods 依赖项,这是此模板所需的
问题描述
在执行时npx react-native init MyProject
我遇到了以下错误:
✖ 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.
这似乎与显示的早期错误有关:
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 似乎都运行良好。
我的配置:
- MacOS Catalina 10.15.1 (19B88)
- NPM 6.11.3
- 反应原生 0.61.4
- XCode 11.2.1 (11B500)
任何线索表示赞赏。
解决方案
我发现这里报告了一个非常相似的错误,并提供了一个建议 的解决方案:
sudo xcode-select --switch /Applications/Xcode.app
阅读似乎表明在更新行的某个地方,XCode CLI 工具路径设置为不正确的路径。
同样正如@bibin-jaimon 在下面的评论中所建议的那样,我的机器上确实有多个版本的 XCode(为什么?因为https://stackoverflow.com/a/58329901/606351)。
总之,问题解决了。
推荐阅读
- python - 为什么我们必须在 python 的函数中多次打开文件?
- jquery - 在单击不同的 html 元素时隐藏以前使用 jquery 显示的 html 元素
- angular - Angular - firebase 仅在 EmailVerification 后激活/创建用户
- ios - 在谷歌地图可见区域中拟合两个地理定位点
- spring-boot - 带有弹簧靴的嵌入式 neo4j
- css - CSS使悬停覆盖活动类
- javascript - 如何触发 JQuery 选项卡元素的点击事件
- r - 按多个组计算跨多个列的最大值
- routing - 具有 Istio Ingress 的 Kubernetes 未在标准 HTTP 端口 443/80 上运行
- php - Laravel Guzzle GET 请求