Probably the most Googled error by React Native developers, when you search the issues in the React Native Github project alone you get over a 100 results. And then there's even much more StackOverflow issues, forum posts and so on.
Now the reason why there's so many issues about this is because there's just no easy fix and it can be triggered by a wide range of possible problems. But really, it just hides the underlying issue. Usually it happens though after those goddamned React Native upgrades 😂...
Out of my own experience a few things that helped and resolved the issue for for me in the past. I don't guarantee that it will work but they're all quite harmless so it doesn't hurt to try them one by one. And I'll keep this list updated whenever I come across it again and find a new way to fix it!
rm -rf ./node_modules npm install
Something additional you could do is also remove your node caches before re-installing dependencies.
rm -rf ./node_modules npm cache clean --force npm install
watchman watch-del-all rm -rf $TMPDIR/react-* rm -rf $TMPDIR/metro-* rm -rf $TMPDIR/haste-*
rm -rf ios android react-native eject git checkout ios android
cmd + shift + k)
Reactas the scheme in Xcode and build it (
cmd + b)
Kind of a joke, but also not really. I really had it working sometimes after a random reboot 🤷♂️...
If you have tips & other possible solutions, let me know in the comments!