Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Unhandled JS Exception: TypeError on new iOS project

iOS emulator error

I started getting this error when running an existing project withreact-native run-ios. To try to see if there was something wrong with my project I ran react-native init EmptyProject to create a blank project that should work perfectly. I still get this error even with that.

I've looked at this question on stack overflow and ran ./node_modules/react-native/packager/packager.sh start --resetCache on both my existing project and the empty project to no avail. Any clues as to what might be going on?

like image 324
Christopher Bradshaw Avatar asked Jul 09 '26 09:07

Christopher Bradshaw


1 Answers

After several hours of trial and error I managed to fix the problem. At this point, I don't know which specific thing fixed it, but here's all the main things I did.

  • Updated node to the latest version
  • brew update && brew upgrade
  • brew install watchman
  • Fixed all issues that came up with brew doctor
  • rm -rf ./node_modules ios android
  • yarn
  • react-native upgrade
  • Added babel-preset-react-native-stage-0 as a dev dependency in my package.json
  • Added "react-native-stage-0" as a preset to my babel.rc
  • ./node_modules/react-native/packager/packager.sh start --resetCache

After all of that my projects have been running smoothly again without any problems.

like image 57
Christopher Bradshaw Avatar answered Jul 11 '26 09:07

Christopher Bradshaw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!