“git: 错误:无法确定 '/Applications/.../iPhoneOS13.0.sdk' 的真实路径(错误号=没有这样的文件或目录)\n

Eas*_*Liu 5 git xcode ios cocoapods

我尝试了React-Native init一个新项目,但它告诉我没有 CocoaPods 并希望我安装,例如:

info Installing required CocoaPods dependencies
? CocoaPods (https://cocoapods.org/) is not installed. It's necessary for iOS pr
oject to run correctly. Do you want to install it? Yes
Run Code Online (Sandbox Code Playgroud)

好吧,我之前已经安装了 Cocoapods,但是我输入了 Yes,但它失败了:

Password:
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.3/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version` ("git: error: Failed to determine realpath of '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk' (errno=No such file or directory)\ngit: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk -find git 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory)\ngit: error: unable to find utility \"git\", not a developer tool or in PATH\n") (RuntimeError)
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.3/lib/cocoapods/command.rb:130:in `verify_minimum_git_version!'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.3/lib/cocoapods/command.rb:49:in `run'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.3/bin/pod:55:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'

(node:77073) UnhandledPromiseRejectionWarning: Error: Failed to update CocoaPods repositories for iOS project.
Please try again manually: "pod repo update".
CocoaPods documentation: https://cocoapods.org/
    at updatePods (/Users/easerliu/Projects/test1/app3/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/installPods.js:81:11)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:77073) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:77073) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Run Code Online (Sandbox Code Playgroud)

当我输入pod install pod repo update和其他 pod 命令时,总是得到这样的错误:

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.3/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version` ("git: error: Failed to determine realpath of '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk' (errno=No such file or directory)\ngit: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk -find git 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory)\ngit: error: unable to find utility \"git\", not a developer tool or in PATH\n") (RuntimeError)
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.3/lib/cocoapods/command.rb:130:in `verify_minimum_git_version!'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.3/lib/cocoapods/command.rb:49:in `run'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.3/bin/pod:55:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'

Run Code Online (Sandbox Code Playgroud)

我尝试重新安装 Cocoapods

sudo gem install cocoapods
Password:
Successfully installed cocoapods-1.8.3
Parsing documentation for cocoapods-1.8.3
Done installing documentation for cocoapods after 3 seconds
1 gem installed
Run Code Online (Sandbox Code Playgroud)

sudo xcodebuild -license 但它不工作。BTW我昨天更新了Xcode,不知道是不是这个原因

版本 11.1 (11A1027)

任何人都可以帮助我吗?

Von*_*onC 2

首先检查重新启动 XCode 是否有帮助,或者检查“XCode 首选项位置”选项卡以确保您引用的是新的更新版本。

然后再次尝试 cocoapods 命令。

  • 谢谢,重启一下就可以了。 (2认同)