1--- 2title: Clearing bundler caches on macOS and Linux 3--- 4 5> Need to clear development caches on Windows? [Find the relevant commands here.](clear-cache-windows.mdx) 6 7There are a number of different caches associated with your project that can prevent your project from running as intended. Clearing a cache sometimes can help you work around issues related to stale or corrupt data and is often useful when troubleshooting and debugging. 8 9To clear the various caches, run: 10 11### Expo CLI and Yarn 12 13```sh 14rm -rf node_modules # With Yarn workspaces, you may need to 15 # delete node_modules in each workspace 16yarn cache clean 17yarn 18watchman watch-del-all 19rm -fr $TMPDIR/haste-map-* 20rm -rf $TMPDIR/metro-cache 21expo start --clear 22``` 23 24### Expo CLI and npm 25 26```sh 27rm -rf node_modules 28npm cache clean --force 29npm install 30watchman watch-del-all 31rm -fr $TMPDIR/haste-map-* 32rm -rf $TMPDIR/metro-cache 33expo start --clear 34``` 35 36### React Native CLI and Yarn 37 38```sh 39rm -rf node_modules # With Yarn workspaces, you may need to 40 # delete node_modules in each workspace 41yarn cache clean 42yarn 43watchman watch-del-all 44rm -fr $TMPDIR/haste-map-* 45rm -rf $TMPDIR/metro-cache 46yarn start -- --reset-cache 47``` 48 49### React Native CLI and npm 50 51```sh 52rm -rf node_modules 53npm cache clean --force 54npm install 55watchman watch-del-all 56rm -fr $TMPDIR/haste-map-* 57rm -rf $TMPDIR/metro-cache 58npm start -- --reset-cache 59``` 60 61## What these commands are doing 62 63It is a good habit to understand commands you find on the internet before you run them. We explain each command below for Expo CLI, npm, and Yarn, but the corresponding commands React Native CLI have the same behavior. 64 65| Command | Description | 66| ------------------------- | ------------------------------------------------------------------------------------------------------------ | 67| `rm -rf node_modules` | Clear all of the dependencies of your project | 68| `yarn cache clean` | Clear the global Yarn cache | 69| `npm cache clean --force` | Clear the global npm cache | 70| `yarn`/`npm install` | Reinstall all dependencies | 71| `watchman watch-del-all` | Reset the `watchman` file watcher | 72| `rm -rf $TMPDIR/<cache>` | Clear the given packager/bundler cache file or directory | 73| `expo start --clear` | Restart the development server and instruct the bundlers (for example, webpack, Metro) to clear their caches | 74