In react-native development, there are multiple caches used when the app is built:
Have you tried gradle cleanBuildCache?
https://developer.android.com/studio/build/build-cache.html#clear_the_build_cache
Clearing the Cache of your React Native Project: if you are sure the module exists, try this steps:
For React Native Init approach (without expo) use:
npm start -- --reset-cache
You can clean cache in React Native >= 0.50 and npm > 5 :
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
Apart from cleaning npm cache you might need to reset simulator or clean build etc.
I went into this issue today, too. The cause was kinda silly -- vscode
auto imported something from express-validator
and caused the bug.
Just mentioning this in case anyone has done all the steps to clear cache/ delete modules or what not.
Clearing the Cache of your React Native Project:
npm < 6.0 and RN < 0.50:
watchman watch-del-all && rm -rf $TMPDIR/react-* &&
rm -rf node_modules/ && npm cache clean && npm install &&
npm start -- --reset-cache
npm >= 6.0 and RN >= 0.50:
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