SDK "iphoneos" cannot be located


React Native 初始化的时候报如下错误

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的命令行版本选择有问题。Xcode 内置 CommandLineTools ,所带的工具也是非常的完美。Apple 还将 CommandLineTools 从 Xcode 剥离出来,供大家使用。通过xcode-select --print-path命令得到路径就是单独安装CommandLineTools工具的默认路径

/Library/Developer/CommandLineTools

所以我们要重新指定xcode的命令行版本
输入
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
即可解决问题。

更多推荐