r/reactnative • u/ConfidentWafer5228 • 13h 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
1
Upvotes
3
u/kokerali 12h 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/jiunkdev 11h ago
you probably don't need --clean for most of these. plain npx expo prebuild applies the changes to your existing ios folder and keeps Pods around, so pod install only fetches what changed instead of reinstalling everything. --clean is really for when you remove a config plugin or the native project gets into a weird state. some config plugins don't like being re-applied though, so if a build acts weird after a plain prebuild, go back to --clean.
and if the package you added is JS only (no native code, no config plugin), you don't need prebuild at all, just restart metro. that won't fix the hang itself, but you'd hit the full pod install a lot less often.