我有一个react native项目,想为iOS native安装cocoa pods,但instal失败了,我在Mac book pro上安装了ruby 2.5.1p57

我已经把错误贴了下来,非常感谢您的帮助

pod install


    Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `GLog` from `../node_modules/react-native/third-party-podspecs/GLog.podspec`
Fetching podspec for `React` from `../node_modules/react-native`
Fetching podspec for `react-native-fetch-blob` from `../node_modules/react-native-fetch-blob`
Fetching podspec for `react-native-google-maps` from `../node_modules/react-native-maps`
Fetching podspec for `react-native-maps` from `../node_modules/react-native-maps/`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
Downloading dependencies
Using DoubleConversion (1.1.5)
Using Folly (2016.09.26.00)
Installing GLog (0.3.4)
#<Thread:0x00007fd5349ba008@/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:166 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    3: from /usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:169:in `block in reader'
    2: from /usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:169:in `loop'
    1: from /usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:170:in `block (2 levels) in reader'
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:170:in `readpartial': stream closed in another thread (IOError)
#<Thread:0x00007fd5349b9ea0@/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:166 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    3: from /usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:169:in `block in reader'
    2: from /usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:169:in `loop'
    1: from /usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:170:in `block (2 levels) in reader'
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:170:in `readpartial': stream closed in another thread (IOError)
[!] /bin/bash -c 
set -e
#!/bin/bash
set -e

PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"
CURRENT_ARCH="${CURRENT_ARCH:-armv7}"

export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
export CXX="$CC"

# Remove automake symlink if it exists
if [ -h "test-driver" ]; then
    rm test-driver
fi

./configure --host arm-apple-darwin

# Fix build for tvOS
cat << EOF >> src/config.h

/* Add in so we have Apple Target Conditionals */
#ifdef __APPLE__
#include <TargetConditionals.h>
#include <Availability.h>
#endif

/* Special configuration for AppleTVOS */
#if TARGET_OS_TV
#undef HAVE_SYSCALL_H
#undef HAVE_SYS_SYSCALL_H
#undef OS_MACOSX
#endif

/* Special configuration for ucontext */
#undef HAVE_UCONTEXT_H
#undef PC_FROM_UCONTEXT
#if defined(__x86_64__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
#elif defined(__i386__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip
#endif
EOF

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/simoncigoj/Library/Caches/CocoaPods/Pods/External/GLog/f09d6cdb8398b4922e87d51f5245de7e-ed471/missing: Unknown `--is-lightweight' option
Try `/Users/simoncigoj/Library/Caches/CocoaPods/Pods/External/GLog/f09d6cdb8398b4922e87d51f5245de7e-ed471/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/simoncigoj/Library/Caches/CocoaPods/Pods/External/GLog/f09d6cdb8398b4922e87d51f5245de7e-ed471':
configure: error: C compiler cannot create executables
See `config.log' for more details

推荐答案

查看错误日志(log):

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'

this link上也有同样的错误.

你要么需要做xcode-select,要么至少用XCode,Preferences/Locations/Command Line Tools,我猜.

Ruby相关问答推荐

try 安装Chruby时出现问题,终端问题

如何使用Ruby range?

在 clojure 中,如何将已排序整数数组划分为连续的分区?

从整数中 Select 重复数字的字符串

如何修改 Ruby gem

Ruby:子字符串到一定长度,也到子字符串中的最后一个空格

如何调试/显示使用 RestClient 发送的请求

在 Ruby 早期转义 .each { } 迭代

您如何将 Cucumber 场景标记为待处理

Ruby字符串上的扫描和匹配有什么区别

查找两个数组之间的共同值

class_eval、class_exec、module_eval 和 module_exec 有什么区别?

Sinatra 是多线程的吗?

Ruby 被空格分割

困惑,像python,ruby这样的语言是单线程的吗?不像说java? (对于网络应用程序)

如何转换 Ruby 哈希,使其所有键都是符号?

OpenSSL vs GPG 用于加密异地备份?

Ruby:define_method 与 def

如何使用 minitest 运行所有测试?

传递哈希而不是方法参数