【发布时间】:2021-09-09 17:18:11
【问题描述】:
我开始学习 react-native,但在设置环境时遇到了一些问题,对此我有一些疑问:
第一次写:
npx react-native init new_app
我得到一个错误,那个错误说 try:
cd ./new_app/ios && pod install
然后我得到以下错误:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
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'
/Users/macbookpro/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing: Unknown `--is-lightweight' option
Try `/Users/macbookpro/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/macbookpro/Library/Caches/CocoaPods/Pods/Release/Flipper-Glog/0.3.6-1dfd6':
configure: error: C compiler cannot create executables
See `config.log' for more details
我知道我需要安装 Xcode,但由于某些原因我现在不想安装, 那么在没有安装 Xcode 的情况下我能做些什么让它工作吗?
第二个问题,如何首先为 Android 初始化一个 react-native 应用程序?如果有办法,当我想构建 IOS 应用程序时,我会遇到一些麻烦还是只需要 Xcode 然后为 IOS 构建相同的 android 代码?还是应该为 IOS 和 Android 准备好环境,然后开始在您的应用上运行?
【问题讨论】:
标签: javascript android ios react-native cocoapods