
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
react-native-clean-project
Advanced tools
Cleans your React Native project by purging caches and modules, and reinstalling them again.
yarn add -D react-native-clean-project
This module is automatically detected as a plugin by the standard react-native command, adding new sub-commands:
react-native clean-project-auto - fully automated project state clean: like a freshly-cloned, never-started reporeact-native clean-project - interactive project state clean: choose types of react-native state to cleanFor complete control (including using command-line arguments to non-interactively fine-tune what state is cleaned):
npx react-native-clean-project
Or add it as a script to your package.json
"scripts": {
"clean": "react-native-clean-project"
}
This is a combination of the commands suggested in the React Native documentation plus others.
| State Type | Command | In clean-project-auto? | Optional? | Default? | Option Flag |
|---|---|---|---|---|---|
| React-native cache | rm -rf $TMPDIR/react-* | Yes | No | true | |
| Metro bundler cache | rm -rf $TMPDIR/metro-* | Yes | No | true | |
| Watchman cache | watchman watch-del-all | Yes | No | true | |
| NPM modules | rm -rf node_modules | Yes | Yes | true | --keep-node-modules |
| Yarn cache | yarn cache clean | Yes | Yes | true | --keep-node-modules |
| Yarn packages | yarn install | No | Yes | true | --keep-node-modules |
| NPM cache | npm cache verify | Yes | Yes | true | --keep-node-modules |
| NPM Install | npm ci | Yes | Yes | true | --keep-node-modules |
| iOS build folder | rm -rf ios/build | Yes | Yes | false | --remove-iOS-build |
| iOS pods folder | rm -rf ios/Pods | Yes | Yes | false | --remove-iOS-pods |
| system iOS pods cache | pod cache clean --all | Yes | Yes | true | --keep-system-iOS-pods-cache |
| user iOS pods cache | rm -rf ~/.cocoapods | Yes | Yes | true | --keep-user-iOS-pods-cache |
| Android build folder | rm -rf android/build | Yes | Yes | false | --remove-android-build |
| Android clean project | (cd android && ./gradlew clean) | Yes | Yes | false | --clean-android-project |
| Brew package | brew update && brew upgrade | No | Yes | true | --keep-brew |
| Pod packages | pod update | No | Yes | true | --keep-pods |
Example: npx react-native-clean-project --remove-iOS-build
You can also reset the Metro bundler cache when starting with react-native start --reset-cache
This library does not support windows. PR's are welcome.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details
FAQs
Automating the cleaning of a React Native Project
We found that react-native-clean-project demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.