I was able to build the project without errors, but when I launched my React Native app on iOS I got the following error:
Error Code: Unhandled JS Exception: Can’t find variable: require`
It was working fine, but when I was debugging something else I ended up removing the pods folder, podfile.lock, and .xcworkspace directory and running:
pod deintegrate
pod install
I am not sure exactly why the error is popping up. How can I fix it?
I tried to reset the cache too, but it didn’t change anything.
2
Answers
After reverting back a bunch more commits I realized I had added '@babel/preset-env' as a preset in my babel.config.js file. After removing that the error went away.
Try resetting your cache:
On expo
For React Native CLI: