Solving React Native’s “No bundle url present” Error

I hit the “No bundle url present.” roadblock today and had to dig a bit to find the solution. I’m going to describe how I encountered the problem, and provide the solution that’s worked more than once for me, ever since I found the suggestion in the React Native GitHub repository.

The Problem

  • You’ve got a React Native app.
  • In the terminal, you run react-native run-ios.

In the simulator, you hit a roadblock with the following error in a bright red screen:

No bundle url present. Make sure you’re running a packager server or have included a .jsbundle file in your application bundle.

No bundle URL present

The Solution

Buried in the comments of one of the React Native repo’s issues on GitHub, I found a solution that worked for me…

  • Open a terminal window
  • cd into YOUR_PROJECT/ios
  • Remove the build folder with rm -r build
  • Run react-native run-ios again

Alternatively, you could open Finder, navigate to YOUR_PROJECT/ios and delete the build folder. Then run react-native run-ios again.

I’m not sure what causes this (that bothers me), but but at least I’ve found something to get me going again.

  • danconiaus

    You’re a lifesaver. Thanks a ton!

    • Very glad this helped – It seems odd that I have to do this process so often, but hey – at least it gets things running again!

  • fewspider

    thanks a lot, it is pretty odd, i donot know why react-native cannot handle this

  • Antwan Humphreys

    This seems to be the way with frontend development these days! Same with android in ionic i find….hit and miss if a build will succeed even with the same config on the same machine :p

  • It isn’t working for me, what can i do?

  • Thanks, it saves my day

  • meng yan

    Thank you. It works~

  • this does not work for me but problem was in changing jsCodeLocation for release,

    if you did this, then return back your jsLocation variable back to shared url one in AppDelegate.m

    // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@”main” withExtension:@”jsbundle”];

    jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@”index.ios” fallbackResource:nil];

  • Alexander Zubko

    In my case the log from the native iOS part gave me the hint of the issue:

    2018-01-31 14:51:48.227940+0200 ring[39908:988698] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file.

    I removed the App Transport Security exception before app release long ago, and I forgot about it when the time has come to add some changes to the app.

  • Priyanka Sadh

    Whenever I run react-native run-ios — device [DeviceName], I get an error,ERROR Metro Bundler can’t listen on port undefined.