skip to Main Content

I was able to build the project without errors, but when I launched my React Native app on iOS I got the following error:

Image of error code

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


  1. Chosen as BEST ANSWER

    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.


  2. Try resetting your cache:

    On expo

    expo r -c
    

    For React Native CLI:

    react-native start --reset-cache
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search