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!
What you can try
1. Delete node_modules
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
2. Delete react native caches
watchman watch-del-all rm -rf $TMPDIR/react-* rm -rf $TMPDIR/metro-* rm -rf $TMPDIR/haste-*
3. Remove generated build data
rm -rf ios android react-native eject git checkout ios android
4. Force build the React modules manually
- Open XCode
- Clean (
cmd + shift + k)
Reactas the scheme in Xcode and build it (
cmd + b)
- Build the library that is failing (e.g.
- Build your app again
5. Have you tried turning it off and on again?
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!