New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No bundle url present #12754

Closed
soutot opened this Issue Mar 7, 2017 · 192 comments

Comments

Projects
None yet
@soutot

soutot commented Mar 7, 2017

Description

I noticed some people recently asking about this "No bundle url present" error and I just faced it myself.

Reproduction

I had just run ˜react-native init projectName˜, setup my App.js file (a simple Hello World), called it in both iOS and Android indexes and run ˜react-native run-ios˜. Then the No bundle url present error appeared.

Solution

I tried to delete my node_modules and npm install, close the packager and run the project again, but it could only be solved when I follow the steps given here (http://stackoverflow.com/questions/42610070/what-means-of-no-bundle-url-present-in-react-native).

  • Run "react-native run-ios"
  • When the error appears, run "npm install"
  • Then run "react-native run-ios" again.

Additional Information

This is the first project I started using RN 0.42. Since it never happened before and I am not the only one facing this issue, I guess it should be taken a closer look to it.

Here's my package.json:

{
	"name": "myProject",
	"version": "0.0.1",
	"private": true,
	"scripts": {
		"start": "node node_modules/react-native/local-cli/cli.js start",
		"test": "jest"
	},
	"dependencies": {
		"react": "~15.4.1",
		"react-native": "0.42.0"
	},
	"devDependencies": {
		"babel-jest": "19.0.0",
		"babel-preset-react-native": "1.9.1",
		"jest": "19.0.2",
		"react-test-renderer": "~15.4.1"
	},
	"jest": {
		"preset": "react-native"
	}
}

If I can be more helpful to make any further test, it would be a pleasure.

@edward-of-clt

This comment has been minimized.

Show comment
Hide comment
@edward-of-clt

edward-of-clt Mar 7, 2017

Having the same issue now. Not sure what changed.

Having the same issue now. Not sure what changed.

@decadef20

This comment has been minimized.

Show comment
Hide comment
@decadef20

decadef20 Mar 8, 2017

Same problem.

Same problem.

@edward-of-clt

This comment has been minimized.

Show comment
Hide comment
@edward-of-clt

edward-of-clt Mar 8, 2017

@skv-headless

This comment has been minimized.

Show comment
Hide comment
@skv-headless

skv-headless Mar 8, 2017

Contributor

What if you run npm start in console?

Contributor

skv-headless commented Mar 8, 2017

What if you run npm start in console?

@qyvip

This comment has been minimized.

Show comment
Hide comment
@qyvip

qyvip Mar 8, 2017

Same problem.

I found
JsCodeLocation = [[RCTBundleURLProvider jsBundleURLForBundleRoot:@ sharedSettings] "index.ios" fallbackResource:nil];
Take effective address not, this happens in connection to the network situation (and not all networks such), when this happens, disconnected from the network, I think, in a virtual machine can run in localhost:8081
This is the way I am

qyvip commented Mar 8, 2017

Same problem.

I found
JsCodeLocation = [[RCTBundleURLProvider jsBundleURLForBundleRoot:@ sharedSettings] "index.ios" fallbackResource:nil];
Take effective address not, this happens in connection to the network situation (and not all networks such), when this happens, disconnected from the network, I think, in a virtual machine can run in localhost:8081
This is the way I am

@edward-of-clt

This comment has been minimized.

Show comment
Hide comment
@edward-of-clt

edward-of-clt Mar 8, 2017

@edward-of-clt

This comment has been minimized.

Show comment
Hide comment
@edward-of-clt

edward-of-clt Mar 8, 2017

@qyvip

This comment has been minimized.

Show comment
Hide comment
@qyvip

qyvip Mar 8, 2017

@AbeHerbert

Yes, this is the IOS code, I simply look at the code, here will automatically take the local IP, but obviously, did not take, Android I have not tried, but this is obviously different from the IOS code

My situation when I changed a network environment, it is normal, very clever, when I met the home
I try to print out the automatic access to the full address, are taken to return to the null, at the same time, APP will be waiting for the start of the case, this is the local address

NSLog (@ absoluteString:%@), [jsCodeLocation absoluteString]);
NSLog (@ host:%@), [jsCodeLocation host]);
NSLog (@ port:%@), [jsCodeLocation port]);

When I will

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

Modified into

jsCodeLocation = [NSURL URLWithString:@"http://127.0.0.1:8081/index.ios.bundle?platform=ios&dev=true"];

This time can be a normal start, but after entering the application of remote image loading, it seems wrong
This is just a point of view, and there is no concrete solution

qyvip commented Mar 8, 2017

@AbeHerbert

Yes, this is the IOS code, I simply look at the code, here will automatically take the local IP, but obviously, did not take, Android I have not tried, but this is obviously different from the IOS code

My situation when I changed a network environment, it is normal, very clever, when I met the home
I try to print out the automatic access to the full address, are taken to return to the null, at the same time, APP will be waiting for the start of the case, this is the local address

NSLog (@ absoluteString:%@), [jsCodeLocation absoluteString]);
NSLog (@ host:%@), [jsCodeLocation host]);
NSLog (@ port:%@), [jsCodeLocation port]);

When I will

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

Modified into

jsCodeLocation = [NSURL URLWithString:@"http://127.0.0.1:8081/index.ios.bundle?platform=ios&dev=true"];

This time can be a normal start, but after entering the application of remote image loading, it seems wrong
This is just a point of view, and there is no concrete solution

@rmevans9

This comment has been minimized.

Show comment
Hide comment
@rmevans9

rmevans9 Mar 8, 2017

Contributor

I have gotten that message when the packager is not running when the app is launched on iOS. Typically I have to completely kill the app and launch again after I have started the packager. Can you guys be sure that you have the packager running prior to launching the app?

Contributor

rmevans9 commented Mar 8, 2017

I have gotten that message when the packager is not running when the app is launched on iOS. Typically I have to completely kill the app and launch again after I have started the packager. Can you guys be sure that you have the packager running prior to launching the app?

@soutot

This comment has been minimized.

Show comment
Hide comment
@soutot

soutot Mar 8, 2017

@rmevans9 in my case the packager was running as always. The solution I posted is done while the packager and the app are running. That's the only way I found by now to handle this. I belive there's something going wrong when the modules are installed on react-native init. I have to do some tests before assurance it

soutot commented Mar 8, 2017

@rmevans9 in my case the packager was running as always. The solution I posted is done while the packager and the app are running. That's the only way I found by now to handle this. I belive there's something going wrong when the modules are installed on react-native init. I have to do some tests before assurance it

@qyvip

This comment has been minimized.

Show comment
Hide comment
@qyvip

qyvip Mar 8, 2017

Yes, the packager is already running. I can access it through the browser

qyvip commented Mar 8, 2017

Yes, the packager is already running. I can access it through the browser

@despreston

This comment has been minimized.

Show comment
Hide comment
@despreston

despreston Mar 8, 2017

I am also seeing this issue on RN 0.42.0

I am also seeing this issue on RN 0.42.0

@liqueflies

This comment has been minimized.

Show comment
Hide comment

+1

@Mess1ah

This comment has been minimized.

Show comment
Hide comment
@Mess1ah

Mess1ah Mar 9, 2017

Same problem and I run "npm install" and "react-native run-ios" ,the problem seems to be not solved yet.

Mess1ah commented Mar 9, 2017

Same problem and I run "npm install" and "react-native run-ios" ,the problem seems to be not solved yet.

@yustada

This comment has been minimized.

Show comment
Hide comment
@yustada

yustada Mar 9, 2017

I am seeing same problem @0.42.0 and
"npm install" does not solve it.

yustada commented Mar 9, 2017

I am seeing same problem @0.42.0 and
"npm install" does not solve it.

@yustada

This comment has been minimized.

Show comment
Hide comment
@yustada

yustada Mar 9, 2017

My problem has been solved by adding NSAllowsLocalNetworking to Info.plist

<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
		<key>NSAllowsArbitraryLoadsInWebContent</key>
		<true/>
		<key>NSAllowsLocalNetworking</key>
		<true/>
	</dict>
</key>

I am not sure it is because of RN0.42 or iOS issue, but it is solved in my case.

yustada commented Mar 9, 2017

My problem has been solved by adding NSAllowsLocalNetworking to Info.plist

<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
		<key>NSAllowsArbitraryLoadsInWebContent</key>
		<true/>
		<key>NSAllowsLocalNetworking</key>
		<true/>
	</dict>
</key>

I am not sure it is because of RN0.42 or iOS issue, but it is solved in my case.

@akiver

This comment has been minimized.

Show comment
Hide comment
@akiver

akiver Mar 12, 2017

Check if you have 127.0.0.1 localhost in your hosts, clean the project and retry, it worked for me.

akiver commented Mar 12, 2017

Check if you have 127.0.0.1 localhost in your hosts, clean the project and retry, it worked for me.

@edward-of-clt

This comment has been minimized.

Show comment
Hide comment
@edward-of-clt

edward-of-clt Mar 12, 2017

@shivashp

This comment has been minimized.

Show comment
Hide comment
@shivashp

shivashp Mar 13, 2017

Contributor

I found a working solution, Give it a try. While the simulator is running don't close your bundler. Go to the path and run npm install then again react-native run-ios. It started working for me.

Contributor

shivashp commented Mar 13, 2017

I found a working solution, Give it a try. While the simulator is running don't close your bundler. Go to the path and run npm install then again react-native run-ios. It started working for me.

@adamnator92

This comment has been minimized.

Show comment
Hide comment
@adamnator92

adamnator92 Mar 13, 2017

i faced this issues after i moved my project to another directory and run ios simulator

adamnator92 commented Mar 13, 2017

i faced this issues after i moved my project to another directory and run ios simulator

@jaxondu

This comment has been minimized.

Show comment
Hide comment
@jaxondu

jaxondu Mar 13, 2017

This is working for me: leave simulator running, leave the packager terminal window on, and run react-native run-ios again.

jaxondu commented Mar 13, 2017

This is working for me: leave simulator running, leave the packager terminal window on, and run react-native run-ios again.

@powercoder23

This comment has been minimized.

Show comment
Hide comment
@powercoder23

powercoder23 Mar 13, 2017

This also means the "Port already in use"

Terminating a process on port 8081

Run the following command on a Mac to find the id for the process that is listening on port 8081:

$ sudo lsof -i :8081

Then run the following to terminate the process:

$ kill -9 <PID>

please try troubleshooting in below link
https://facebook.github.io/react-native/docs/troubleshooting.html

Thanks,
Dhiraj

This also means the "Port already in use"

Terminating a process on port 8081

Run the following command on a Mac to find the id for the process that is listening on port 8081:

$ sudo lsof -i :8081

Then run the following to terminate the process:

$ kill -9 <PID>

please try troubleshooting in below link
https://facebook.github.io/react-native/docs/troubleshooting.html

Thanks,
Dhiraj

@cesarkawakami

This comment has been minimized.

Show comment
Hide comment
@cesarkawakami

cesarkawakami Mar 14, 2017

I'm just leaving this here, in case other people stumble upon the same cause.

In our team's case, during the migration to 0.42.0, we've accidentally removed the "Bundle React Native code and images" build phase from the XCode project.

Manually re-adding the phase solved the problem, but we're left scratching our heads as to when or how the phase was removed.

sglearner_xcodeproj

I'm just leaving this here, in case other people stumble upon the same cause.

In our team's case, during the migration to 0.42.0, we've accidentally removed the "Bundle React Native code and images" build phase from the XCode project.

Manually re-adding the phase solved the problem, but we're left scratching our heads as to when or how the phase was removed.

sglearner_xcodeproj

@stantoncbradley

This comment has been minimized.

Show comment
Hide comment
@stantoncbradley

stantoncbradley Mar 14, 2017

works for me when I build the app through xcode...

works for me when I build the app through xcode...

@grundmanise

This comment has been minimized.

Show comment
Hide comment
@grundmanise

grundmanise Mar 16, 2017

Same issue. Have set scheme to Release in Xcode and trying to archive the app for production, but main.jsbundle is not generating...

grundmanise commented Mar 16, 2017

Same issue. Have set scheme to Release in Xcode and trying to archive the app for production, but main.jsbundle is not generating...

@cutemachine

This comment has been minimized.

Show comment
Hide comment
@cutemachine

cutemachine Mar 16, 2017

I had the same error and was able to run the app only through Xcode. react-native run-ios did not work. To resolve the issue you need to remove the build folder YOUR_PROJECT/ios/build/. After this you should be able to run your app through react-native run-ios again. Hope this helps.

I had the same error and was able to run the app only through Xcode. react-native run-ios did not work. To resolve the issue you need to remove the build folder YOUR_PROJECT/ios/build/. After this you should be able to run your app through react-native run-ios again. Hope this helps.

@pkral78

This comment has been minimized.

Show comment
Hide comment
@pkral78

pkral78 Mar 16, 2017

For Debug configuration, which is default when new project is generated with react-native init command, build does not generate bundle file but instead uses packager for that. So the issue is related to network settings and is very likely related to proxy settings. If proxy is used, do not forget to set bypass proxy for localhost and 127.0.0.1 addresses.

pkral78 commented Mar 16, 2017

For Debug configuration, which is default when new project is generated with react-native init command, build does not generate bundle file but instead uses packager for that. So the issue is related to network settings and is very likely related to proxy settings. If proxy is used, do not forget to set bypass proxy for localhost and 127.0.0.1 addresses.

@gperdomor

This comment has been minimized.

Show comment
Hide comment
@gperdomor

gperdomor Mar 16, 2017

Contributor

Same here... Install the node packages again is not a proper solution

Contributor

gperdomor commented Mar 16, 2017

Same here... Install the node packages again is not a proper solution

@arrchhy

This comment has been minimized.

Show comment
Hide comment
@arrchhy

arrchhy Mar 16, 2017

In my case it was because I was running Shadowsocks (being in China at the moment) and I didn't set it to bypass 127.0.0.1 and localhost. Thanks @om2pkral for mentioning that.

arrchhy commented Mar 16, 2017

In my case it was because I was running Shadowsocks (being in China at the moment) and I didn't set it to bypass 127.0.0.1 and localhost. Thanks @om2pkral for mentioning that.

@yoonchulkoh

This comment has been minimized.

Show comment
Hide comment
@yoonchulkoh

yoonchulkoh Mar 18, 2017

In my case, nothing was displayed on the other terminal that started up when react-native run-ios was executed.
It means that packager is not running.

So I was able to start packager by running PROJECT_DIR/node_modules/react-native/packager/launchPackager.command myself.
I run react-native run-ios again, it started up normally.

I don't know the cause, but the behavior of the open command below is doubtful.

shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";

In my case, nothing was displayed on the other terminal that started up when react-native run-ios was executed.
It means that packager is not running.

So I was able to start packager by running PROJECT_DIR/node_modules/react-native/packager/launchPackager.command myself.
I run react-native run-ios again, it started up normally.

I don't know the cause, but the behavior of the open command below is doubtful.

shellScript = "if [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\nif nc -w 5 -z localhost 8081 ; then\nif ! curl -s \"http://localhost:8081/status\" | grep -q \"packager-status:running\" ; then\necho \"Port 8081 already in use, packager is either not running or not running correctly\"\nexit 2\nfi\nelse\nopen \"$SRCROOT/../packager/launchPackager.command\" || echo \"Can't start packager automatically\"\nfi\nfi";

@xiaotianhu

This comment has been minimized.

Show comment
Hide comment
@xiaotianhu

xiaotianhu Mar 19, 2017

Thanks to @om2pkral and @account-archived-270316 ,Shadowsocks in global mode cause the problem;If you're running a proxy then try to close it;

Thanks to @om2pkral and @account-archived-270316 ,Shadowsocks in global mode cause the problem;If you're running a proxy then try to close it;

@npomfret

This comment has been minimized.

Show comment
Hide comment
@npomfret

npomfret Mar 19, 2017

Contributor

I moved from 42.0 to 42.2 and got this error with my test flight deployment. I deleted the build directory AND added <key>NSAllowsLocalNetworking</key>... <true/> and it started working again. Don't know which of the 2 was the magic though. I'm going to assume the 1st and remove the info.plist change.

Contributor

npomfret commented Mar 19, 2017

I moved from 42.0 to 42.2 and got this error with my test flight deployment. I deleted the build directory AND added <key>NSAllowsLocalNetworking</key>... <true/> and it started working again. Don't know which of the 2 was the magic though. I'm going to assume the 1st and remove the info.plist change.

@toureek

This comment has been minimized.

Show comment
Hide comment
@toureek

toureek Mar 20, 2017

I ran "react-native run-ios" in a second time, it went well.

toureek commented Mar 20, 2017

I ran "react-native run-ios" in a second time, it went well.

@CharlesMoone

This comment has been minimized.

Show comment
Hide comment
@CharlesMoone

CharlesMoone Mar 21, 2017

check out your localhost
are you open ss? when i met this problem , i found i opened my vpn

check out your localhost
are you open ss? when i met this problem , i found i opened my vpn

@acresta88

This comment has been minimized.

Show comment
Hide comment
@acresta88

acresta88 Mar 21, 2017

I have a similar problem with RN 0.40, it cannot generate the bundle in release mode. It stops with error
`Worker Farm: Received message for unknown index for existing child. This should not happen!

SyntaxError: Unexpected token: punc (.)`
and I cannot understand where the error is, but is the react-native bundle step that fails

I have a similar problem with RN 0.40, it cannot generate the bundle in release mode. It stops with error
`Worker Farm: Received message for unknown index for existing child. This should not happen!

SyntaxError: Unexpected token: punc (.)`
and I cannot understand where the error is, but is the react-native bundle step that fails

@Binb1

This comment has been minimized.

Show comment
Hide comment
@Binb1

Binb1 Mar 22, 2017

@yustada Adding the NSAllowsLocalNetworking key solved my problem but now my NSAllowsArbitraryLoads key doesn't seem to work anymore (I can't load http images anymore for example). Any idea?

Binb1 commented Mar 22, 2017

@yustada Adding the NSAllowsLocalNetworking key solved my problem but now my NSAllowsArbitraryLoads key doesn't seem to work anymore (I can't load http images anymore for example). Any idea?

@jacobcyl

This comment has been minimized.

Show comment
Hide comment
@jacobcyl

jacobcyl Mar 22, 2017

I get the same issue. But I solved it, because I have open proxy. Maybe you can check if you open network proxy, and make sure you have shut it down.

I get the same issue. But I solved it, because I have open proxy. Maybe you can check if you open network proxy, and make sure you have shut it down.

@acresta88

This comment has been minimized.

Show comment
Hide comment
@acresta88

acresta88 Mar 22, 2017

Sorry for the stupid question, but what do you mean for open proxy? I don't think I opened any network proxy, but I guess it may be under the hood. How can I check it and shut it down?

Sorry for the stupid question, but what do you mean for open proxy? I don't think I opened any network proxy, but I guess it may be under the hood. How can I check it and shut it down?

@jacobcyl

This comment has been minimized.

Show comment
Hide comment
@jacobcyl

jacobcyl Mar 22, 2017

Maybe we are in different environment . I don't have this issue yesterday and before, but get this error today cause have open a shadowsocks proxy soft ware which used to proxy. So when I turn it off, anything go ok. I don't know if you get the same problem. The RN app in local debug mode would download bundle from local host:localhost, so if I have use the network agency, it can not find local host. I dont know if you understand what I say? poor english.

jacobcyl commented Mar 22, 2017

Maybe we are in different environment . I don't have this issue yesterday and before, but get this error today cause have open a shadowsocks proxy soft ware which used to proxy. So when I turn it off, anything go ok. I don't know if you get the same problem. The RN app in local debug mode would download bundle from local host:localhost, so if I have use the network agency, it can not find local host. I dont know if you understand what I say? poor english.

@g3r4n

This comment has been minimized.

Show comment
Hide comment
@g3r4n

g3r4n Mar 22, 2017

@yustada your solution (here) solve my issue. I think put this parameter will fix something broken in Xcode. All my projects are not debuggable !

g3r4n commented Mar 22, 2017

@yustada your solution (here) solve my issue. I think put this parameter will fix something broken in Xcode. All my projects are not debuggable !

@TheGreatAndrew

This comment has been minimized.

Show comment
Hide comment
@TheGreatAndrew

TheGreatAndrew Dec 21, 2017

I don;t know how but it's work, thanks
also people, search :common error in react native
it's helpful

I don;t know how but it's work, thanks
also people, search :common error in react native
it's helpful

@simplepanda

This comment has been minimized.

Show comment
Hide comment
@simplepanda

simplepanda Dec 21, 2017

@vegidio Did you make any headway and seeing why start isn't being called?

simplepanda commented Dec 21, 2017

@vegidio Did you make any headway and seeing why start isn't being called?

@liugangnhm

This comment has been minimized.

Show comment
Hide comment
@liugangnhm

liugangnhm Dec 22, 2017

@NARUTOyuyang work for me, I used xxNet..... and open globalProxy option...

i closed global proxy option and then worked.

liugangnhm commented Dec 22, 2017

@NARUTOyuyang work for me, I used xxNet..... and open globalProxy option...

i closed global proxy option and then worked.

@CrazyPeter

This comment has been minimized.

Show comment
Hide comment
@CrazyPeter

CrazyPeter Dec 25, 2017

1.rm -rf ios/build
2.sudo vi /private/etc/hosts

 # Add this line
 127.0.0.1       localhost

works for me.

CrazyPeter commented Dec 25, 2017

1.rm -rf ios/build
2.sudo vi /private/etc/hosts

 # Add this line
 127.0.0.1       localhost

works for me.

@phil-andrews

This comment has been minimized.

Show comment
Hide comment
@phil-andrews

phil-andrews Dec 30, 2017

Add localhost to the AppTransportSecurity was my issue as well. Built for production and had to take it out, when I came back to work on it for got to put it back in.

<key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>localhost</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> </dict> </dict> </dict>

Add localhost to the AppTransportSecurity was my issue as well. Built for production and had to take it out, when I came back to work on it for got to put it back in.

<key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>localhost</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> </dict> </dict> </dict>

@zjx

This comment has been minimized.

Show comment
Hide comment
@zjx

zjx Jan 2, 2018

after upgrade to Xcode 9.2 i need to add below code snippet in the info.plist to fix this issue..

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
	<true/>
	<key>NSAllowsArbitraryLoadsInWebContent</key>
	<true/>
	<key>NSExceptionDomains</key>
	<dict>
		<key>localhost</key>
		<dict>
			<key>NSExceptionAllowsInsecureHTTPLoads</key>
			<true/>
		</dict>
	</dict>
</dict>

zjx commented Jan 2, 2018

after upgrade to Xcode 9.2 i need to add below code snippet in the info.plist to fix this issue..

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoads</key>
	<true/>
	<key>NSAllowsArbitraryLoadsInWebContent</key>
	<true/>
	<key>NSExceptionDomains</key>
	<dict>
		<key>localhost</key>
		<dict>
			<key>NSExceptionAllowsInsecureHTTPLoads</key>
			<true/>
		</dict>
	</dict>
</dict>
@vegidio

This comment has been minimized.

Show comment
Hide comment
@vegidio

vegidio Jan 3, 2018

@simplepanda In my case apparently it was a problem with IntelliJ. They had a bug related to React Native that was fixed in the latest version (2017.3.2) and it's working again after I updated.

vegidio commented Jan 3, 2018

@simplepanda In my case apparently it was a problem with IntelliJ. They had a bug related to React Native that was fixed in the latest version (2017.3.2) and it's working again after I updated.

@expaand

This comment has been minimized.

Show comment
Hide comment
@expaand

expaand Jan 7, 2018

My story: I had been using Xcode to build a React Native app for IOS for a few weeks (latest React Native, latest Xcode (9.2), on High Sierra), and everything was working great. All of a sudden, today, I got that dreaded "No bundle URL present".

I carefully read through all of the answers here. I tried a few things, but nothing really worked. Then I noticed, at the beginning of messages on the Xcode console, a message which said something like "bare http:// cannot be used...", and maybe something about Transport Security. Now, my app doesn't use any URL's (let alone an empty URL) so this was a bit puzzling. At any rate, I tried what Phil Andrews (and zjx) suggested: put in an exception for "localhost" under NSAppTransportSecurity in info.plist.

And it works! Why this worked without this before and now this is required, is truly a mystery!

expaand commented Jan 7, 2018

My story: I had been using Xcode to build a React Native app for IOS for a few weeks (latest React Native, latest Xcode (9.2), on High Sierra), and everything was working great. All of a sudden, today, I got that dreaded "No bundle URL present".

I carefully read through all of the answers here. I tried a few things, but nothing really worked. Then I noticed, at the beginning of messages on the Xcode console, a message which said something like "bare http:// cannot be used...", and maybe something about Transport Security. Now, my app doesn't use any URL's (let alone an empty URL) so this was a bit puzzling. At any rate, I tried what Phil Andrews (and zjx) suggested: put in an exception for "localhost" under NSAppTransportSecurity in info.plist.

And it works! Why this worked without this before and now this is required, is truly a mystery!

@jjdraijer

This comment has been minimized.

Show comment
Hide comment
@jjdraijer

jjdraijer Jan 19, 2018

Try to

npm install metro

Solved it because of a bug

Try to

npm install metro

Solved it because of a bug

@shadowbrush

This comment has been minimized.

Show comment
Hide comment
@shadowbrush

shadowbrush Jan 23, 2018

If anyone wants a script for turning on/off the transport security in Info.plist:

    var fs = require('fs');
    var plist = require('plist');

    function modifyIosTransportSecurity(plistPath, enable) {
      var info = plist.parse(fs.readFileSync(plistPath, 'utf8'));
      info.NSAppTransportSecurity.NSAllowsArbitraryLoads = !enable;
      info.NSAppTransportSecurity.NSAllowsArbitraryLoadsInWebContent = !enable;
      info.NSAppTransportSecurity.NSAllowsLocalNetworking = !enable;
      fs.writeFileSync(plistPath, plist.build(info));
    }

I'm calling this from a pre- and post-build script that were added to XCode's build phases.

If anyone wants a script for turning on/off the transport security in Info.plist:

    var fs = require('fs');
    var plist = require('plist');

    function modifyIosTransportSecurity(plistPath, enable) {
      var info = plist.parse(fs.readFileSync(plistPath, 'utf8'));
      info.NSAppTransportSecurity.NSAllowsArbitraryLoads = !enable;
      info.NSAppTransportSecurity.NSAllowsArbitraryLoadsInWebContent = !enable;
      info.NSAppTransportSecurity.NSAllowsLocalNetworking = !enable;
      fs.writeFileSync(plistPath, plist.build(info));
    }

I'm calling this from a pre- and post-build script that were added to XCode's build phases.

@KangYoosam

This comment has been minimized.

Show comment
Hide comment
@KangYoosam

KangYoosam Jan 23, 2018

There are two apps(same project) on the simulator. Once I delete the new one, problem got resolved.

There are two apps(same project) on the simulator. Once I delete the new one, problem got resolved.

@OrangeFlavoredColdCoffee

This comment has been minimized.

Show comment
Hide comment
@OrangeFlavoredColdCoffee

OrangeFlavoredColdCoffee Jan 24, 2018

image

if you check this, Xcode cannot log some error ..uncheck it and find error
''undefined is not an object( evaluating '_reactNative.ViewPropTypes.style')''

and do like this:

1 import ViewPropTypes from react-native
2change View.propTypes to ViewPropTypes

and it work for me .
if you recently update your RN version ,you may have this .

i had this error only release mode. and dev mode work fine ..i have tried solutions nearly all above .but none works.

:
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

"react": "16.0.0-alpha.12",
"react-dom": "16.0.0-alpha.12",
"react-native": "0.51.0",

and a few days ago ,just update 0.44 to 0.51.0 . if this issues cant fixed. i will roll back to lower version have a try .

OrangeFlavoredColdCoffee commented Jan 24, 2018

image

if you check this, Xcode cannot log some error ..uncheck it and find error
''undefined is not an object( evaluating '_reactNative.ViewPropTypes.style')''

and do like this:

1 import ViewPropTypes from react-native
2change View.propTypes to ViewPropTypes

and it work for me .
if you recently update your RN version ,you may have this .

i had this error only release mode. and dev mode work fine ..i have tried solutions nearly all above .but none works.

:
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

"react": "16.0.0-alpha.12",
"react-dom": "16.0.0-alpha.12",
"react-native": "0.51.0",

and a few days ago ,just update 0.44 to 0.51.0 . if this issues cant fixed. i will roll back to lower version have a try .

@shaunsaker

This comment has been minimized.

Show comment
Hide comment
@shaunsaker

shaunsaker Jan 29, 2018

Not sure if this will help you guys but I changed my build config in Xcode (Product => Scheme => Edit Scheme) back to Debug and it worked.

Not sure if this will help you guys but I changed my build config in Xcode (Product => Scheme => Edit Scheme) back to Debug and it worked.

@infinito84

This comment has been minimized.

Show comment
Hide comment
@infinito84

infinito84 Feb 1, 2018

This work for me:

react-native link
react-native run-ios

This work for me:

react-native link
react-native run-ios
@miniyarov

This comment has been minimized.

Show comment
Hide comment
@miniyarov

miniyarov Feb 4, 2018

Based on this thread and some other there are a lot of errors causing this problem.
But mine was related with localhost domain. So make sure you have set 127.0.0.1 localhost in your /etc/hosts for Linux/Unix or equivalent file on Windows.

Based on this thread and some other there are a lot of errors causing this problem.
But mine was related with localhost domain. So make sure you have set 127.0.0.1 localhost in your /etc/hosts for Linux/Unix or equivalent file on Windows.

@bagana89

This comment has been minimized.

Show comment
Hide comment
@bagana89

bagana89 Feb 8, 2018

if your project opened by xcode. please close the xcode and run again, it works for me

bagana89 commented Feb 8, 2018

if your project opened by xcode. please close the xcode and run again, it works for me

@nabil-mansouri

This comment has been minimized.

Show comment
Hide comment
@nabil-mansouri

nabil-mansouri Feb 18, 2018

Hi guys,
I solved it on my device by replacing on AppDelegate.m:

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

By:

http://IP_ADDRESS_ON_MY_LAN:8081/index.ios.bundle?platform=ios&dev=true

Where IP_ADDRESS_ON_MY_LAN = 192.168....

nabil-mansouri commented Feb 18, 2018

Hi guys,
I solved it on my device by replacing on AppDelegate.m:

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

By:

http://IP_ADDRESS_ON_MY_LAN:8081/index.ios.bundle?platform=ios&dev=true

Where IP_ADDRESS_ON_MY_LAN = 192.168....

@monkingame

This comment has been minimized.

Show comment
Hide comment
@monkingame

monkingame Mar 1, 2018

I met the same issue after build release version(under ios).
I changed the followings and got normal result.
1)change AppDelegate.m codes:
comment
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
and uncomment
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
2)re-enable ATS localhost in Info.plist
App Transport Security Settings -> Excepiton Domains -> localhost -> NSExceptionAllowsInsecureHTTPLoads -> TRUE
3)run react-native run-ios again and reload the app in simulator

monkingame commented Mar 1, 2018

I met the same issue after build release version(under ios).
I changed the followings and got normal result.
1)change AppDelegate.m codes:
comment
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
and uncomment
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
2)re-enable ATS localhost in Info.plist
App Transport Security Settings -> Excepiton Domains -> localhost -> NSExceptionAllowsInsecureHTTPLoads -> TRUE
3)run react-native run-ios again and reload the app in simulator

@JohnSmith0602

This comment has been minimized.

Show comment
Hide comment
@JohnSmith0602

JohnSmith0602 Mar 3, 2018

@monkingame Thx, the localhost part saved my day!

@monkingame Thx, the localhost part saved my day!

@FrankSandqvist

This comment has been minimized.

Show comment
Hide comment
@FrankSandqvist

FrankSandqvist Mar 3, 2018

@monkingame Thanks, the changing of comments worked for me. I have no idea what caused this error to start happening to begin with, started after I made the production build and wanted to back to debugging. How did that change the code location?

@monkingame Thanks, the changing of comments worked for me. I have no idea what caused this error to start happening to begin with, started after I made the production build and wanted to back to debugging. How did that change the code location?

@originalix

This comment has been minimized.

Show comment
Hide comment
@originalix

originalix Mar 8, 2018

This work for me.

rm -rf ios/build
react-native run-ios

This work for me.

rm -rf ios/build
react-native run-ios
@marcelotadeujr

This comment has been minimized.

Show comment
Hide comment
@marcelotadeujr

marcelotadeujr Mar 11, 2018

This work for me.

rm -rf ios/build/; kill $(lsof -t -i:8081);
react-native run-ios

This work for me.

rm -rf ios/build/; kill $(lsof -t -i:8081);
react-native run-ios
@alangumer

This comment has been minimized.

Show comment
Hide comment
@alangumer

alangumer Mar 13, 2018

run
yarn start or npm start
to start the development server

if necessary run again:
react-native run-ios

https://stackoverflow.com/a/48016926/4636856

run
yarn start or npm start
to start the development server

if necessary run again:
react-native run-ios

https://stackoverflow.com/a/48016926/4636856

@EsdrasEtrenne

This comment has been minimized.

Show comment
Hide comment
@EsdrasEtrenne

EsdrasEtrenne Mar 20, 2018

For me for some reason the jsCodeLocation changed in AppDelegate.m

make sure it is
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

EsdrasEtrenne commented Mar 20, 2018

For me for some reason the jsCodeLocation changed in AppDelegate.m

make sure it is
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

@GemN

This comment has been minimized.

Show comment
Hide comment
@GemN

GemN Mar 22, 2018

From another thread after trying everything, that solution worked:

"this is solved my issue:
info.plist → information Property List → + App Transport Security Settings → + Allow Arbitrary Loads = YES"

GemN commented Mar 22, 2018

From another thread after trying everything, that solution worked:

"this is solved my issue:
info.plist → information Property List → + App Transport Security Settings → + Allow Arbitrary Loads = YES"

@rishabh-saxena

This comment has been minimized.

Show comment
Hide comment
@rishabh-saxena

rishabh-saxena Mar 24, 2018

I got it resolved by including the below code in Info.plist file which I had removed from the production build.
<key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>localhost</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> </dict> </dict> </dict>

I got it resolved by including the below code in Info.plist file which I had removed from the production build.
<key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>localhost</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> </dict> </dict> </dict>

@mikenk2010

This comment has been minimized.

Show comment
Hide comment
@mikenk2010

mikenk2010 Mar 27, 2018

Easy boy, just remove ios/build (rm -rf ios/build) then run react-native run-ios again! Take me 30m to figure out...LOL...

Easy boy, just remove ios/build (rm -rf ios/build) then run react-native run-ios again! Take me 30m to figure out...LOL...

@yogeshR5

This comment has been minimized.

Show comment
Hide comment
@yogeshR5

yogeshR5 Apr 3, 2018

@jiteshwadia same problem occurred to me.
what I have to do now??

yogeshR5 commented Apr 3, 2018

@jiteshwadia same problem occurred to me.
what I have to do now??

@bjacobs09

This comment has been minimized.

Show comment
Hide comment
@bjacobs09

bjacobs09 Apr 5, 2018

For me, I was having a problem with Node not being recognized in any new tab opened. So I have to use nvm use in every new tab. Because the bundler was opening in a new tab when I ran npm run ios, it wasn't seeing Node. And I can't type in that bundler terminal for some reason.

So my solution was in one tab run nvm use 8.9.3 or whatever version you're on, then in that tab run npm start. Then open a new tab and do nvm use 8.9.3 and in that tab run npm run ios or however you run your simulator.

For me, I was having a problem with Node not being recognized in any new tab opened. So I have to use nvm use in every new tab. Because the bundler was opening in a new tab when I ran npm run ios, it wasn't seeing Node. And I can't type in that bundler terminal for some reason.

So my solution was in one tab run nvm use 8.9.3 or whatever version you're on, then in that tab run npm start. Then open a new tab and do nvm use 8.9.3 and in that tab run npm run ios or however you run your simulator.

@LuckyCrab

This comment has been minimized.

Show comment
Hide comment
@LuckyCrab

LuckyCrab Apr 16, 2018

This work for me.

react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'

This work for me.

react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'
@Air-Rands

This comment has been minimized.

Show comment
Hide comment
@Air-Rands

Air-Rands Apr 29, 2018

I had the same issue and after trying everything here qyvip's answer lead me to the right one.
In the ios>"Your Main Project Folder">AppDelegate.m .

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

to be
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

I had the same issue and after trying everything here qyvip's answer lead me to the right one.
In the ios>"Your Main Project Folder">AppDelegate.m .

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

to be
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

@miksansegundo

This comment has been minimized.

Show comment
Hide comment
@miksansegundo

miksansegundo May 5, 2018

This worked for me. Check that your main.jsbundle is targeted to your main Project.
I also had to clean the caches.
image

miksansegundo commented May 5, 2018

This worked for me. Check that your main.jsbundle is targeted to your main Project.
I also had to clean the caches.
image

@tayfunyasar

This comment has been minimized.

Show comment
Hide comment
@tayfunyasar

tayfunyasar May 22, 2018

Adding NSAllowsArbitraryLoads: true solved my problem.

Adding NSAllowsArbitraryLoads: true solved my problem.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.