DEV Community

MJ Abadilla
MJ Abadilla

Posted on • Updated on

React Native cleanup practices that will keep you sane.

All of the commands here can be executed separately. Don't be afraid to clean up your React Native project every once in a while of or when something unexpected happens.

Doing a good cleanup first often saves the trouble of filing an issue ticket and waiting for someone else to suggest that you reinstall the app.. etc.

What the scripts will do?

  1. Cleanup react dependencies and cache

  2. Cleanup metro bundler cache and files

  3. Cleanup react-native haste cache references

  4. Cleanup ios and android files

  5. Always reset cache when using npm start

  6. Optionally run script file after every package installation

  7. Run pod install after every package installation

How to use:

Don't forget to close all Metrobundler (or the like) instances first before running. A killpackager script is added to start a close and new instance every npm start
Close all emulators or simulators
run cleanup:all and take a break

See the code here:

React Native cleanup scripts

What if the errors are not fixed?

Go and read the error logs and ask the community if you need to. Use the repository issue tracker or stackoverflow

Top comments (0)