5

I tried to React-Native init a new project, but it told me there is no CocoaPods and want me to install, like blow:

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

well I already installed Cocoapods before, however I typed Yes, but it failed:

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.

When I type pod install pod repo update and other pod command, always get error like this:

/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>'

I tried reinstall 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

and sudo xcodebuild -license but it does not work. BTW I updated Xcode yesterday, I do not know if it is the reason

Version 11.1 (11A1027)

Anyone can help me?

Easer Liu
  • 53
  • 1
  • 5

1 Answers1

2

Check first if restarting XCode helps, or check the XCode Preference Locations tab to make sure you are referencing the new updated version.

Then try again the cocoapods command.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250