操作系统安装错误。无法安装模块glog

时间:2018-05-21 12:16:11

标签: ios react-native cocoapods

我正在尝试将“react-native”从“0.50.4”升级到“0.55”。

当我运行pod安装时,我收到错误

checking for a BSD-compatible install... /usr/local/bin/ginstall -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... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... no
checking for arm-apple-darwin-gcc...  -arch armv7 -isysroot 
checking whether the C compiler works... no
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
/Users/MacBook/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing: Unknown `--is-lightweight' option
Try `/Users/MacBook/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/MacBook/Library/Caches/CocoaPods/Pods/Release/glog/0.3.4-1de0b':
configure: error: C compiler cannot create executables
See `config.log' for more details


[!] Automatically assigning platform `ios` with version `8.0` on target `quanta_react` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

我是react-native的初学者,我不能在我的iOS项目中安装pod。 提前谢谢。

6 个答案:

答案 0 :(得分:5)

大多数情况下,如果您拥有多个Xcode开发版本,就会发生这种情况。那就是发生在我身上的事情。您可以尝试将xcode-select路径重新配置/更改为默认Xcode.app:

首先检查您的Xcode应用名称

xcode-select -p

如果不是Xcode.app那么这样做:

sudo xcode-select --switch /Applications/Xcode.app

之后再次运行pod install

如果已经设置为Xcode.app,请尝试以下操作:

cd node_modules/react-native/third-party/glog-* ../../scripts/ios-configure-glog.sh

我不需要这样做,因为之前的步骤已经完成,也许它可以帮助你:)

答案 1 :(得分:1)

我正在推广Chase Holland的评论,因为它解决了我的问题:删除Xcode路径中的所有空格。

/Applications/Xcode 10.0.app:将导致以上错误

/Applications/Xcode10.0.app:不会

答案 2 :(得分:0)

尝试以下命令。 sudo xcode-select --switch /应用程序/Xcode.app

答案 3 :(得分:0)

如果有人仍然遇到glog 0.3.4的问题,则将以下行添加到Podfile中可能会有所帮助。看来pod可能会卡在较旧的版本上,而实际上Pod正在安装较新的版本。

pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'

答案 4 :(得分:0)

只需重新启动我的Mac,它对我来说就起作用了。

答案 5 :(得分:0)

重命名您的Xcode应用程序名称,确保应用程序名称不包含空格字符。(Xcode 11.app到Xcode11.app)

然后使用 sudo xcode-select --switch

切换到Xcode

sudo xcode-select -switch /Applications/Xcode11.app /

然后执行pod安装