While Using React Native Do You Know How to clear react-native cache? If you don’t know then read this tutorial. We will discuss all possible methods to clear the cache. Let’s start this tutorial without wasting your time.
How to clear react-native cache?
- How to clear react-native cache?
To clear react-native cache If You have npm >= 6.0 and RN >= 0.50 then Just run this command one by one: watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* and then run rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean –force then npm install && npm start — –reset-cache Now, Your Cache is Cleared Successfully.
- clear react-native cache
To clear react-native cache Simply Just run this Command: react-native start –reset-cache For npm users: npm start — –reset-cache and if you are yarn users: expo start -c For npx users: npx react-native start –reset-cache Now, Your cache is cleared successfully.
Solution 1: Use this command
Simply Just run this Command.
react-native start --reset-cache
For npm users,
npm start -- --reset-cache
and if you are yarn users,
expo start -c
OR
yarn cache clean
For npx users,
npx react-native start --reset-cache
Now, Your cache is cleared successfully.
Solution 2: For npm < 6.0
If You have npm < 6.0 and RN < 0.50 then Just run this command one by one.
watchman watch-del-all && rm -rf $TMPDIR/react-*
rm -rf node_modules/ && npm cache clean && npm install
npm start -- --reset-cache
Now, Your Cache is Cleared Successfully.
Solution 3: npm >= 6.0
If You have npm >= 6.0 and RN >= 0.50 then Just run this command one by one.
watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-*
rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean --force
npm install && npm start -- --reset-cache
Now, Your Cache is Cleared Successfully.
Conclusion
It’s all About this error. Hope We solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read
- ‘React’ must be in scope when using JSX react/react-in-jsx-scope
- Module not found: Can’t resolve ‘react-router-dom’
- How to Download File in React js?
- How to Use .env File in React Project?
- Attempted import error: ‘Redirect’ is not exported from ‘react-router-dom’