At the end of initialization of the new project I'm getting this question:
info Installing required CocoaPods dependencies
? CocoaPods (https://cocoapods.org/) is not installed. It's necessary for iOS project to run correctly. Do you want to install it?
I'm answering "no". Then I'm getting:
(node:8910) UnhandledPromiseRejectionWarning: Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually
And further down:
(node:8910) 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: 3)
(node:8910) [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.
Why is CocoaPods needed at all? Just a few months ago react native cli did not try to install it. I remember installing CocoaPods in the past for some reason, and if I remember correctly, what it does it creates a HUGE folder with all sorts of useless repositories. Since then, I got rid of it and I don't want to install it again.
It's a decision React Native core team made to simplify dependency management and essentially allow for autolinking on iOS.
So, if I don't install it, nothing will work? Or there are some workarounds?
Also, do I need to re-init the above project after installing CocoaPods?
So, if I don't install it, nothing will work? Or there are some workarounds?
That's right, the default template won't work without CocoaPods. You can create your own that does not base on CocoaPods, or research if there's something like this already done. But RN is moving more parts into CocoaPods and not following that will become a burden.
Also, do I need to re-init the above project after installing CocoaPods?
No, after installing CocoaPods, you need to run pod install inside ios directory to install deps and then open *.xcworkspace file.
OK, understood... Thanks!
what it does it creates a HUGE folder with all sorts of useless repositories. Since then, I got rid of it and I don't want to install it again.
Unsure if you鈥檙e referring to the spec repo in ~/.cocoapods/repos/master. If so and re-trying to use CocoaPods, you may want to try out the new CDN repo http://blog.cocoapods.org/CocoaPods-1.7.2/, which will become the default in v1.8.0 http://blog.cocoapods.org/CocoaPods-1.8.0-beta/.
@alloy yes please! <3
Managed to get it working, finally.
First, installed latest ruby with homebrew (mainly to avoid using sudo): brew install ruby
Then made it preferred by modifying .bash_profile file:
export PATH="/usr/local/opt/ruby/bin:$PATH"
Then installed your recommended cocoapods 1.8.0 beta: gem install cocoapods --pre
For some reason, the pod binary was not exposed after that, so had to modify .bash_profile file again: export PATH="/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"
Now new project initialization works without issues and I'm getting "Welcome to React Native" screen when running react-native run-ios :)
Most helpful comment
Unsure if you鈥檙e referring to the spec repo in
~/.cocoapods/repos/master. If so and re-trying to use CocoaPods, you may want to try out the new CDN repo http://blog.cocoapods.org/CocoaPods-1.7.2/, which will become the default in v1.8.0 http://blog.cocoapods.org/CocoaPods-1.8.0-beta/.