0

I am following the steps at React Native Getting Started and I am unable to get the application running. When I run cd /Users/brandonsmac/SysDevMobileApps/ReactNative/AwesomeApp" && npx react-native run-ios

It will say successfully built, but when I got to view the screen it says "Bundle URL Missing"

I notice there is the following post that I tried react-native No bundle URL present and I still get the error.

Also, I can show what happens when I run it with the expo but that fails as well.

Can someone please help me?

B. Cratty
  • 1,423
  • 14
  • 28

2 Answers2

3

The answer I found here worked. https://onexlab-io.medium.com/no-bundle-url-present-fixed-ca2688a80f66

Step 1:

  • Open the package.json file and add the following line '"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='iOS'"'
  • Now your file looks like this following screenshot

[Step 1][

Step 2:

  • Run following command. It will generate main.jsbundle file

    yarn build:ios or npm run build:ios

Step 3:

  • Open iOS project in Xcode show as following screenshot

Step 3 Part 1

  • Select -> Target → Build Phases under Copy Bundle Resources click on the plus button as following screenshot.

Step 3 Part 2

  • It will show you the prompt as shown below. Then select the file main.jsbundle and click on the Add button

Step 3 Part 3

Step 4:

Try to re-run your app

npx react-native run-ios
or
react-native run-ios

Step 5:

TA DA!! Step 5 Complete

B. Cratty
  • 1,423
  • 14
  • 28
  • A variation of this answer worked for me. After it ran I noticed i was not able to debug remotely, it was complaning about localhost:8081, so I checked my HOSTS file and saw that at some point I removed the _127.0.0.1_ localhost reference. After I put it back, I was able to debug again remotely. – RiaanP Aug 20 '21 at 06:37
  • I have tried this solution but get the error, error opening bundle private/var/containers/Bundle/Application/xxx.xxx.xxx/myappnative.app/main.jsbundle&inlineSourceMap=true - any ideas? – Bomber Oct 06 '21 at 09:40
0

For me it was fixed by unchecking run script only when installing here:

Targets -> Build Phases -> Bundle React Native code and images

Bundle React Native code and images

MasterPiece
  • 222
  • 3
  • 9