Where Does React Native's Metro Cache Live?
Metro caches transforms in $TMPDIR/metro-* with haste maps beside them. Clearing sequence, --reset-cache and custom stores.
Last updated
Metro (React Native's bundler) caches transformed modules in temp directories named metro-* under $TMPDIR, with haste-map-* neighbors tracking the file map. Stale entries here cause the classic red-screen-that-survives-reinstalls, since node_modules wipes don't touch temp.
The documented exorcism runs in order: watchman watch-del-all, fresh install, --reset-cache on start, then rm -rf the metro-* and haste-map-* temp dirs. Custom cacheStores in metro.config.js (FileStore rooted anywhere) relocate the transformer cache for persistent CI. Expo wraps the same Metro with its own -c flag doing equivalent work.
Where React Native stores this, by platform
$TMPDIR/metro-cache
Plus $TMPDIR/haste-map-* and $TMPDIR/metro-* siblings. Clear with rm -rf plus start --reset-cache. Watchman watches clear separately with watchman watch-del-all.
${TMPDIR:-/tmp}/metro-cache
Same temp-based trio, falling back to /tmp without TMPDIR. Containers with tiny /tmp should redirect via cacheStores FileStore to a bigger volume.
%TEMP%\metro-cache
Same role under the Windows temp root. Reset flag works identically (start --reset-cache). Long paths here occasionally trip bundler limits, another reason to relocate.
Frequently asked questions
Metro serves stale code after my fix, what do I clear?
Run watchman watch-del-all, reinstall node_modules, restart with --reset-cache, and delete $TMPDIR/metro-* plus $TMPDIR/haste-map-*. Each layer caches independently, so partial clearing leaves ghosts.
How do I move the Metro cache?
Set cacheStores with a FileStore rooted at your path in metro.config.js, optionally alongside remote HttpCache stores. Point CI at persistent storage so warm caches survive between runs.
Notice an outdated path? Let us know.