main.jsbundle does not exist [fixed]

No bundle URL present.

Make sure you’re running a packager server or
have include a .jsbundle file in your application
bundle.

If you are getting this error in React Native App. you can follow following steps to fix

Image for post

Video Tutorial

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

Image for post

Step 2:

Run following command. It will generate main.jsbundle file

yarn build:iosornpm run build:ios

Step 3:

Open iOS project in Xcode show as following screenshot

Image for post

Select -> Target → Build Phases

under Copy Bundle Resources click on the plus button as following screenshot.

Image for post

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

Image for post

Step 4:

Try to re-run your app

npx react-native run-iosorreact-native run-ios

Step 5:

You did it

Image for post

Thank you :)

Written by

We teach & develop for startups

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store