When I run a react-native project, I get a error no bundle URL present
, but I don\'t know what mistakes I do, I was very confused.
Reason:
This is because the app cannot find out the server (which serves the UI - by javascript code).
Solution:
npm run start
or yarn start
firstLoading dependency graph, done.
)react-native run-ios/android
Explanation:
React Native comes with 2 parts:
Build commands:
react-native run-ios/android
is to build native part then deploy to devices and start app on devices (simulator/emulator/real device). This usually took 3~4 mins to finish.
npm run start
or yarn start
is to build the javascript part and start the dev server to serve the built UI to the app. This usually took 30 secs to finish.
=> Normally, the javascript part finished first then the native part came later. (based on time they used).
=> this is only true for the first time build (fresh build).
=> for re-build:
The native part just took 10~15 secs to check changes and because no change for native part => done before the javascript part was built and served. (I am not sure the javascript part was rebuilt or not but it took long time than native part)
So that is why we had this issue, the app ran and required thing that did not exist yet.
Bonus:
react-native run-ios/android
will auto start the dev server for you.react-native run-ios/android
right after react-native init <app_name>
, everything ran well. (because auto start feature and the time was took for fresh build as state above).Time used on this answer was relative to my machine => may different on others.
Had same problem when I did bundle my app.
Check that your main.jsbundle
is targeted to your main Project
What solved it for me:
cd
into YOUR_PROJECT/ios
rm -r build
react-native run-ios
againAlternatively, you could open Finder, navigate to YOUR_PROJECT/ios
and delete the build
folder.
Then run react-native run-ios
again.
Source: Andrew Bancroft
Close your simulator and the terminal. Open new one and go to your project, then upgrade your react-native like this:
react-native upgrade
Issue in: Infinite recursion in RCTFatal when the bundle fails to execute.
I have found the easiest/quickest way to bypass this is to exit the app within the simulator (2 x Cmd + Shift + H
) and re-launch.
I just ran into this problem as well (first time getting started with React Native). The problem disappeared when - while an ios simulation(react-native run-ios
) was running - I ran npm install
and then react-native run-ios
again. In the terminal window, it showed that it was bundling, and then the simulator showed the welcome screen.
Check this link for briefs after react-native init PropertyFinder
line try to use npm start
(This one works for me)
========================================================================
UPDATE for 16.9
My port 8081 was blocked by McAfee. Using a different port directly wasn't working react-native start --port=8082
and react-native run-ios --port=8082
Tried almost all solutions given here. but anything didn't work.
"react": "16.9.0",
"react-dom": "^16.12.0",
"react-native": "0.61.5",
Solution:
Searched for 8081 in Xcode and replaced all of them with 8082. Then run the same commands to build and run the app. App works smoothly
react-native start --port=8082
react-native run-ios --port=8082