N Kaushik

How to clear cache in a react-native project

April 07, 2021

How to clear cache in a react-native project

Clearing out cache is another way if your project is not working. React-native project throws unknown bugs sometimes and it gets automatically fixed if you clear the cache.

just-restart-it.png

How to clear cache:

It is simple. But before that, remove the node_modules folder and install it again.

rm -rf node_modules

then

npm i 
or 
yarn add

then start the server by restarting the cache:

npm start -- --reset-cache

or

yarn start --reset-cache

If it doesn’t work,

reset watchman:

watchman watch-del-all

reset cache for react-native (if react-native cli is installed):

react-native start --reset-cache

For expo, use it:

expo start -c

Subscribe to my Newsletter