I get the following error when trying to do react-native run-ios
(see screenshot below). I have checked this answer as well as the github thread but neither were helpful.
Any ideas on what to look at or how to make this work? The problem seems to be isolated to ios, as the android emulator works ok. Looks like maybe it's some sort of bug with the facebook code.
For those still interested i resolved this just by running
react-native start
which starts the packager in the current terminal window and run in other terminal window
react-native run-ios
I resolved it with the following solution:
Edit <your_project_folder>/ios/<project_name>/AppDelegate.m
and change the jsCodeLocation
variable as follows:
jsCodeLocation =
[NSURL URLWithString:@"http://127.0.0.1:8081/index.ios.bundle?platform=ios&dev=true"];
This happens to me when I work on the same react-native project on different computers. Closing the simulator and deleting the ios > build
folder followed by running react-native run-ios
again solves it for me.
Your issue is that the file main.js
bundle part of iOS is not generated all the times or sometimes is generated, but wrong. To solve the issue, follow these steps:
Add the following line inside the scripts of the package.json
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
Then run following command:
yarn build:ios or npm run build:ios
Open Xcode, select "project", then click the project name; go to the "build phases", then click on "copy build resources" as your main.js
bundle there
Run the react-native run-ios
This works for me
Try this after the simulator is already running:
npm install
react-native run-ios
I also got this error when developing. Try this solution in the simulator:
Hold down shift + cmd + H twice to bring up running apps
Then swipe up on your the app you would like to get rid of.
Click on your app.
This worked for me, after looking through countless solutions this was all I actually needed to do! Hope this helps.
For me, I did not have watchman installed. To check if you have it installed, from your terminal you can run brew list
. If you do not see watchman listed, simply run brew install watchman
.
NOTE: If you get this error during installation:
Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
xcode-select --install
You need to install the Xcode Command Line Tools. So, from your terminal run xcode-select --install
. After installation of the tools is complete, you will need to re-run brew install watchman
. Then you should be able to start your project by running react-native run-ios
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With