Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear react-native cache?

In react-native development, there are multiple caches used when the app is built:

  1. React-native packager cache
  2. Emulator cache
  3. Java side cache (.gradle) folder (only in android)
  4. npm cache (if relevant?)

Am I missing something also? Because I'm trying to clear cache in react-native, to be able to repeat a bug that only occurs on first usage. But clearing those caches above did not help. This is on android. When the app is building, most of the rows DO NOT say UP-TO-DATE, as expected, because I cleared the cache.

But, there are still many rows where this text is printed. Like:

app:preBuild UP-TO-DATE

app:preDebugBuild UP-TO-DATE

:app:preReleaseBuild UP-TO-DATE

The question is, how can I clear the whole cache related to react-native development?

like image 887
Ville Miekk-oja Avatar asked Oct 22 '17 20:10

Ville Miekk-oja


People also ask

How do you clear cache in React JS in NPM?

Clearing the cache To clear a cache in npm, we need to run the npm cache clean --force command in our terminal. clean: It deletes the all data from your cache folder.


1 Answers

For React Native Init approach (without expo) use:

npm start -- --reset-cache 
like image 163
Haris Anwar Avatar answered Sep 30 '22 12:09

Haris Anwar