React Native Unhandled JS Exception: TypeError for New iOS Project
I started getting this error when starting an existing project with react-native run-ios
. To try and figure out if there is something wrong with my project, I ran react-native init EmptyProject
to create an empty project, which should work fine. I am still getting this error even with this.
I have looked into this Stack Overflow question and ran in ./node_modules/react-native/packager/packager.sh start --resetCache
both my existing project and an empty project to no avail. Any clues as to what might be going on?
source to share
After hours of trial and error, I was able to fix this issue. At the moment I don't know what specific thing fixed it, but here are all the main things I did.
- Updated node to the latest version
-
brew update && brew upgrade
-
brew install watchman
- Fixed all problems that occurred when using
brew doctor
-
rm -rf ./node_modules ios android
-
yarn
-
react-native upgrade
- Added
babel-preset-react-native-stage-0
as a dev dependency in mypackage.json
- Added parameter "react-native-stage-0" as preset for my
babel.rc
-
./node_modules/react-native/packager/packager.sh start --resetCache
After all this, my projects were running smoothly without any problems.
source to share