Reputation: 2622
I just upgraded to Xcode 10 and now after attempting to run my existing projects I was met with the below error. After searching I found the following issue when running react native init https://github.com/facebook/react-native/issues/21490. This solution also fixes my issue.
However I am wondering if anyone knows why my current project now require me to run the bundler as a separate instance. It's not the end of the world but it's certainly not the best experience.
Does anyone know of a way the get everything working as it was before without the need to run the following commands:
Upvotes: 1
Views: 2061
Reputation: 1
You may need to add an additional Build Phase to the xCode project after "Bundle React Native code and images"
Add a new build script by selecting the + sign on the top left and selecting "New Run Script Phase" then add the following
if nc -w 5 -z localhost 8081 ; then
if ! curl -s "http://localhost:8081/status" | grep -q "packager-
status:running" ; then
echo "Port 8081 already in use, packager is either not running or not
running correctly"
exit 2
fi
else
open "$SRCROOT/../node_modules/react-
native/scripts/launchPackager.command" || echo "Can't start packager
automatically"
fi
Upvotes: 0
Reputation: 2573
I had issues with the build after Xcode update, what I did to fix it is switch the Build System to Legacy Build System
From File > Workspace Settings
Or by pressing on the hammer icon on the right of the status bar
Change the build system to Legacy Build System
Also make sure that you still have the bundle script in Build Phases
Tell me know if that works with you
Upvotes: 1