react-native icon indicating copy to clipboard operation
react-native copied to clipboard

App still runs in port 8081 even after changing AppDelegate.m

Open es6Test opened this issue 11 years ago • 12 comments

As per instructions to change port I changed AppDelegate.m port: jsCodeLocation = [NSURL URLWithString:@"http://localhost:8082/index.ios.bundle?platform=ios&dev=true"];

But when running I still get the app trying to connect to 8081

Note, I am running the xcode project in the UIExplorer demo in the RN repo.

es6Test avatar Oct 10 '15 18:10 es6Test

See http://facebook.github.io/react-native/docs/troubleshooting.html#port-already-in-use-red-screen

es6Test avatar Oct 10 '15 18:10 es6Test

Is this the same issue as 1429? I can't get it to work either because I have something already running on 8081.

aarongreenwald avatar Oct 25 '15 14:10 aarongreenwald

It appears that the instructions are incomplete - I got it to work after doing a global find/replace from 8081 to a new number (in my case 8082), INCLUDING in the react-native npm folder. That last bit was what got me for a while until a coworker suggested I do the find/replace there as well.

This should be a setting that can be easily configured, but right now 8081 is hardcoded in a bunch of places, it seems.

aarongreenwald avatar Oct 26 '15 13:10 aarongreenwald

I've posted this on product pains so it would be great if you could upvote it there and show the react-native team that this is an important feature https://productpains.com/post/react-native/allow-packager-port-to-be-configurable-change-from-8081/

qimingweng avatar Dec 24 '15 17:12 qimingweng

I voted. Thanks!

aarongreenwald avatar Dec 24 '15 17:12 aarongreenwald

Closing in favour of #1429

satya164 avatar Dec 24 '15 18:12 satya164

Hello there,

I have fixed this issue by the step below: if you installed McAfee antivirus, the default port of McAfee log is 8081. You should manual change the port of your react native server

Step 1: go to \node_modules\react-native\local-cli\server\server.js and change the port 8081 to 8088

const args = parseCommandLine([{ command: 'port', default: 8088, type: 'string', }

Step 2: Create an "assets" folder under "android/app/src/main"

Step 3: in node.js run "react-native start" and navigate to the url "http://localhost:8088/index.android.bundle?platform=android"

Step 4: save the bundle to assets folder and you are all set. in node.js run "react-native run-android" to view the result

Regards,

Hai Tang

haitang3009 avatar Apr 24 '16 06:04 haitang3009

Is this issue fixed now? I am still not able to make it work in my office laptop where McAfee agent is running at port 8081. I am still seeing 8081 is hardcoded in lot of places in react native code in latest build.

abhranilnaha avatar Aug 03 '16 03:08 abhranilnaha

@haitang3009 I have the same problem with @abhranilnaha ,Now I can run my app and can view my content 'hello world',but when I am double-click the key ‘r’ to refresh,a red screen show:"The development server returned response error code:403;URL:http://10.0.3.2:8081/Index.android.bundle?platform=android&dev=true&hot=false&minify=false……" how could I solve the problem?

codepandy avatar Sep 01 '16 03:09 codepandy

@codepandy Did you get your problem resolve? I have the same problem now!

jayhuang75 avatar Jun 14 '17 01:06 jayhuang75

@jayhuang75 sorry,I didn't solve the problem.

codepandy avatar Jun 14 '17 02:06 codepandy

This is kinda old, but I'm still having this conflict with McAfee, any update on this?

canastro avatar Aug 20 '17 14:08 canastro