Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native No bundle URL present

Tags:

react-native

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.

enter image description here

like image 749
dcp Avatar asked Mar 22 '17 12:03

dcp


7 Answers

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
like image 138
Jayffe Avatar answered Oct 09 '22 22:10

Jayffe


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"];
like image 27
dcp Avatar answered Oct 09 '22 20:10

dcp


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.

like image 29
maesk Avatar answered Oct 09 '22 20:10

maesk


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:

  1. 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'"

  2. Then run following command:

    yarn build:ios or npm run build:ios

  3. 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

  4. Run the react-native run-ios

This works for me

like image 25
Narender Singh Avatar answered Oct 09 '22 20:10

Narender Singh


Try this after the simulator is already running:

npm install

react-native run-ios

like image 30
RainCast Avatar answered Oct 09 '22 22:10

RainCast


I also got this error when developing. Try this solution in the simulator:

  1. Hold down shift + cmd + H twice to bring up running apps

  2. Then swipe up on your the app you would like to get rid of.

  3. Click on your app.

This worked for me, after looking through countless solutions this was all I actually needed to do! Hope this helps.

like image 33
Ega Avatar answered Oct 09 '22 21:10

Ega


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.

like image 22
David Avatar answered Oct 09 '22 22:10

David