Cli: Installing CocoaPods takes a long time with no status indicator

Created on 22 Jul 2019  Β·  8Comments  Β·  Source: react-native-community/cli

Environment

System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
    Memory: 1.02 GB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
    Yarn: 1.7.0 - ~/.yarn/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
    Watchman: 4.9.4 - /opt/facebook/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 23, 24, 25, 26, 27, 28
      Build Tools: 23.0.1, 25.0.0, 25.0.2, 27.0.3, 28.0.2, 28.0.3, 29.0.0
      System Images: android-24 | Intel x86 Atom, android-24 | Google APIs Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom, android-25 | Google Play Intel x86 Atom
      Android NDK: 15.2.4203891
  IDEs:
    Android Studio: 3.3 AI-182.5107.16.33.5314842
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.4 => 0.60.4

Description

When init'ing a new project, I got a prompt that CocoaPods is not installed. I entered my password and gave it permission to install. The installation took a long time but there was no progress indicator so it wasn't clear if it hung or not. All I know is that my CPU usage was high.

...
β”œβ”€ [email protected]
β”œβ”€ [email protected]
β”œβ”€ [email protected]
└─ [email protected]
✨  Done in 7.56s.
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? Yes
Password:

A progress indicator, or even passing through stdout during this process would be helpful to know that the process hasn't hung.

Reproducible Demo

On a machine with cocoapods not installed, run npx react-native init cocoapodstest and give permission to install cocoapods.

bug init

Most helpful comment

Maybe it really makes sense to pass stdout here. We'll investigate what can be done

All 8 comments

Ah, this actually looks like it should have been solved by https://github.com/react-native-community/cli/issues/487

I just created this project so I imagine I would have been on 2.7.1. I'll check again when I get back to my computer.

Yep, still repros on 2.7.1

$ yarn why @react-native-community/cli
yarn why v1.7.0
warning ../package.json: No license field
[1/4] πŸ€”  Why do we have the module "@react-native-community/cli"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] πŸ”  Finding dependency...
[4/4] 🚑  Calculating file sizes...
=> Found "@react-native-community/[email protected]"
info Reasons this module exists
   - "react-native" depends on it
   - Hoisted from "react-native#@react-native-community#cli"
info Disk size without dependencies: "1.17MB"
info Disk size with unique dependencies: "15.12MB"
info Disk size with transitive dependencies: "105.59MB"
info Number of shared dependencies: 223
✨  Done in 1.32s.

Maybe it really makes sense to pass stdout here. We'll investigate what can be done

@TheSavior during the init, have you seen other loading indicators and only the CocoaPods installation step didn't have any?

I tried to reproduce it and this is how it looks in my case: https://asciinema.org/a/SjZyniwPvWKoWSc12Fijqt8dP

still have problems.. on macOS Mojave

sudo gem install cocoapods

[!] You cannot run CocoaPods as root.

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? Yes
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)

Usage:

    $ pod COMMAND

      CocoaPods, the Cocoa library package manager.

Commands:

    + cache      Manipulate the CocoaPods cache
    + env        Display pod environment
    + init       Generate a Podfile for the current directory
    + install    Install project dependencies according to versions from a
                 Podfile.lock
    + ipc        Inter-process communication
    + lib        Develop pods
    + list       List pods
    + outdated   Show outdated project dependencies
    + repo       Manage spec-repositories
    + setup      Setup the CocoaPods environment
    + spec       Manage pod specs
    + update     Update outdated project dependencies and create new Podfile.lock

Options:

    --silent     Show nothing
    --version    Show the version of the tool
    --verbose    Show more debugging information
    --no-ansi    Show output without ANSI codes
    --help       Show help banner of specified command
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.7.5/lib/cocoapods/command.rb:47:in `run'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.7.5/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:22:in `load'
    from /usr/local/bin/pod:22:in `<main>'

(node:621) 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/brody/Desktop/AwesomeProject/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/installPods.js:81:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:621) 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:621) [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.

you must install yarn

brew install yarn

@TheSavior @thymikee I assume this is because it’s cloning the specs repo. In v1.7 a CDN version of this was added, which only fetches the specs you need during dependency resolution and is thus much faster, however only in v1.8 will it become the default. I.e. I wouldn’t spend a lot of time on this just yet.

Closing, as CocoaPods 1.8+ is already present for a few months now, resulting in faster installs.

Was this page helpful?
0 / 5 - 0 ratings