Closed
Description
Description
This issue is spun off from #12754, to log a specific situation to create the "No bundle url present" error. I am running into the error message "No bundle URL present" in the iOS emulator when react-native run-ios
is executed a subsequent time after a first successful execution. Specifically, once I close the terminal tab/window that spun off a React Packager process, I will run into this error.
I'm sure this screenshot is familiar from other React-Native issues, but here it is again:
Reproduction Steps and Sample Code
From a brand new project (not built)
- Run
react-native run-ios
- Observe that a tab for React Packager is spun off. As a part of it execution, the following line will appear in output:
Bundling index.ios.js ... done
- Observe that the iOS emulator is able to run the project successfully
- Close both the emulator and the tab for React Packager
- Run
react-native run-ios
again - Observe that both the React Packager tab and the emulator will open. However, the "Bundling index.ios.js" will not appear and the error screen in the emulator will occur.
From a project already built
- Run
react-native run-ios
- Similar to the last step above, the error in the emulator will occur. Also, the "Bundling index.ios.js" will not appear in the React Packager tab. So basically in this situation, we get to the error even faster than before.
Solution
The following workarounds exist, although each of them has their own reason why they are undesirable workarounds:
- Remove the built iOS code via
rm -rf ios/build
. However, this defeats the purpose of the code-reloading that React Packager offers, since I would have to wait for a full rebuild every time I want to test out new changes. - Keep the React Packager tab always open. However, I find it unreasonable to enforce this requirement on development environments (for example, developers would not be able to turn off their computers, or else this bug would occur again after the computer restarts).
- Immediately run
react-native run-ios
again. But there seems to be redundancy, slowness and sloppiness in this solution, having to run a command a second time just to avoid an error.
Additional Information
- React Native version:
$ react-native --version react-native-cli: 2.0.1 react-native: 0.44.0
- Platform: iOS
- Development Operating System: MacOS 10.12.4
- Dev tools: Xcode, using the iOS 9.3 simulator