Clean and Reinstall RN dependencies
How to do a full clean reinstall of React Native dependencies when cached builds cause issues
The Problem#
When we change the library version, it’s easy to have some issues that are because the caches contains old version code, causing a pods/embedding issue.
The Solution#
Do the clean install
How to Do It#
From repo root:
watchman watch-del-all || true
rm -rf $TMPDIR/metro-* $TMPDIR/haste-map-*
rm -rf node_modules
yarn install
cd ios
# or remove all derived data: ~/Library/Developer/Xcode/DerivedData/*
rm -rf Pods Podfile.lock ~/Library/Developer/Xcode/DerivedData/<project_name>-*
pod cache clean --all
pod installbashOn your test device or emulator, delete the app (or Device -> Erase All Content and Settings…)
Quit and reopen Xcode, clean build folder (Product -> Clean Build Folder…).
Start metro and build the app again
watchman watch-del-all && yarn cache clean && yarn start --reset-cache --verbosebashSummary#
A full clean reinstall — clearing Watchman, Metro cache, node_modules, Pods, and DerivedData — resolves most stale-cache build issues after changing library versions in React Native.