r/reactnative • • 12d ago

Help Installing CocoPods... takes forever

EDIT: SOLVED , Thanks to u/kokerali and u/jiunkdev

As the title states, whenever i need to use expo's CNG ( i.e. when i change package.json, bring native deps or change app.json) i need to run "npx expo prebuild --clean" according to the docs, but the build process is simply random, most of the times the cocoapods will never finish, sometimes it does somehow.

I did search for this, found an old reddit post with instructions to pod repo remove trunk but that also didnt help ( it works sometimes randomly)

Please help

2 Upvotes

7 comments sorted by

3

u/kokerali 12d ago

Since it only hangs some of the time, I'd first find out which step it's stuck on. Run npx expo prebuild --clean --no-install, then cd ios && pod install --verbose. The verbose output shows the exact pod or download it's waiting on, which tells you a lot more than retrying.

A common one is hermes-engine, which downloads a fairly large prebuilt tarball during pod install, so a slow or flaky connection looks like a hang right there. If it's stuck on a git clone of some dependency instead, that also points at the network rather than the specs repo, and removing trunk wouldn't help with either.

Also, --clean deletes the ios folder every time, so every run is a full pod install from scratch. If you only added a JS package you don't need prebuild at all, and for native changes plain npx expo prebuild without --clean is often enough and a lot faster.

1

u/ConfidentWafer5228 12d ago

Can u please help with when I need to do --clean, cuz in docs it is not clear and I am new, it really wastes huge amount of time waiting for installation 

1

u/kokerali 12d ago

Most of the time plain npx expo prebuild is enough, like the other reply says. The cases where --clean is worth the wait: after upgrading the Expo SDK, after removing a package with native code or a config plugin, or when something you changed in app.json doesn't show up in the build. Prebuild is good at adding things to the native project but not at taking them back out, so that's where leftovers cause trouble.

One thing to know: --clean throws away the ios and android folders, so any change you made there by hand is gone. With CNG those folders are usually in .gitignore and every native change lives in app.json or a plugin, which is what makes --clean safe to run.

1

u/ConfidentWafer5228 12d ago

Thanks for telling, hopefully now i can actually run the app instead of waiting for pods haha.

0

u/[deleted] 12d ago

[removed] — view removed comment

1

u/ConfidentWafer5228 12d ago

Thanks for clearing out the differences , now i can work with this :]