What does 'No bundle URL present' mean in react-native/xcode?
Asked Answered
F

4

8

I've set up a react native app and want to use xcode to build/run the projectName.xcworkspace file but I run into this error.

I tried the same with a brand new react native project I created without changing anything and I get the same error. What does this mean and how do I solve it?

This is the error

Fissi answered 20/1, 2022 at 19:9 Comment(1)
Does this answer your question? What is the meaning of 'No bundle URL present' in react-native?Camelopardalis
C
2

This usually means that your app is not connected to your localhost (metro bundler is not running). To solve this, you can try running the following commands: react-native start, then react-native run-ios (this will automatically build the app so there is no need to build it in xcode).

If the problem still persists, then you might have to check your localhost port and make sure that the app is using port 8081.

Colchester answered 20/1, 2022 at 20:36 Comment(3)
So I can do this once and then just run in xcode or will I still need to run npx react-native start? I tried with npm start and then run in xcode and that worked as wellFissi
I think after you run it once and it is configured, you just have to call npx react-native start to watch your code, and next time you can build it either through xcode or the run-ios command.Colchester
The bundler should automatically start when running react-native run-ios. If not, something is wrong.Fluster
O
1

run

react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'

in your root folder

Outcast answered 28/3, 2023 at 9:51 Comment(0)
K
1

I know this was asked one year ago but maybe this answer will be helpful too, especially if somebody runs xcode 14.3.1(latest for today)

I tried to clean the build folder and recompile and it just stays the same.

Solution: click the "reload" button at the bottom of the error message and the metro console window should show that now it loads the application.

Kiwi answered 23/7, 2023 at 13:25 Comment(1)
Great input for the latest version!Fissi
D
0

I had the same problem.

What I've done was:

  1. Run watchman watch-del '/your/project/path/'; watchman watch-project '/your/project/path/';
  2. Run npx react-native start
  3. In your Simulator: go to Menu -> Device -> Erase all content and settings...
  4. Clean, build and rerun your project from Xcode

And, that's it!

Dairying answered 21/8, 2024 at 14:48 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.