You might notice during your react native development journey that sometimes, despite your best efforts, errors and warnings just won't go away. 🤔 This is often because React Native and its associated tools like Metro Bundler and Watchman cache files to speed up the build process. While this is generally helpful, it can occasionally be the cause of mysterious errors that don't seem related to any recent changes in your code.
If you find yourself stuck on an issue that you can't seem to resolve, resetting your project's cache might just be the magic trick you need. 🪄 Cache resetting can eliminate inconsistencies and corrupted files, thereby allowing you to run a clean build. This is particularly useful when:
You've installed or removed packages: Sometimes the cache holds onto references from older or removed packages.
You're switching branches on Github: If you switch between different branches that have various configurations or dependencies, the cache can get confused.
Unexplained Errors: When you encounter errors that don't correlate with the changes you've made, it could be due to outdated or corrupted cache files.
You can use the file inside the resources folder, navigate to the root of your project and save it there.
Go to the root of your project /MobileApp from terminal
If you are trying to run the script for the first time ever do
icacls clean-all-windows.bat /grant Everyone:F
run this from your terminal
clean-all-windows.bat
once your metro bundler opens quit it using Control + C
Run the command you would usually run in your terminal to run the application and make sure everything is okay
for example
npx react-native run-android