GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Port is hard coded to 8081 on iOS, Android templates · Issue #9145 · react/react-native

Port is hard coded to 8081 on iOS, Android templates #9145

New issue
Copy link
New issue
Copy link
Closed
Closed
Port is hard coded to 8081 on iOS, Android templates#9145
Copy link
Assignees
hramos
Labels
BugGood first issueInterested in collaborating? Take a stab at fixing one of these issues.Help Wanted :octocat:Issues ideal for external contributors.Platform: AndroidAndroid applications.Platform: iOSiOS applications.Ran CommandsOne of our bots successfully processed a command.Resolution: BacklogAn issue that should be solved at some point, but it's not in the immediate roadmap.Resolution: LockedThis issue was locked by the bot.

Description

@jdmarshall
jdmarshall
opened on Aug 1, 2016
Issue body actions

The documentation on working around port conflict issues is no longer valid

https://facebook.github.io/react-native/docs/troubleshooting.html

Mentions the command line and the URL in AppDelegate.m (which has changed to a function call now)
but does not mention that

node_modules/react-native/React/React.xcodeproj/project.pbxproj

has 8081 hard-coded

Also, to be perfectly blunt, telling people to kill their virus scanner is negligent behavior. We need a solution that doesn't involve asking people to turn off safety features their organization mandated that they use. Especially when you have a company name attached to that advice.

Reacted by William Perkola, Jacob Patenaude, Nick Colgan, Imran Brown, Ocie Mitchell, Maksym Rusynyk, Samer Murad, uvinw, Lazar M, leon and 13 more

Activity

Next
  1. hramos commented on Aug 1, 2016

    @hramos
    hramos
    on Aug 1, 2016
    Contributor
    More actions

    Terminating the process that is using the port is one alternative that is provided, followed with instructions to use a different port which would be a better solution.

    Can you edit https://github.com/facebook/react-native/blob/master/docs/Troubleshooting.md with the latest instructions and submit a PR?

  2. jdmarshall commented on Aug 1, 2016

    @jdmarshall
    jdmarshall
    on Aug 1, 2016
    Author
    More actions

    I can't, because I can't get it to work. Short of searching the entire node_modules directory for instances of 8081 and changing them, because there are new spots that were hard coded after these instructions were written, and there is no obvious way to override them

  3. jdmarshall commented on Aug 1, 2016

    @jdmarshall
    jdmarshall
    on Aug 1, 2016
    Author
    More actions

    react-native/local-cli/server/server.js

    Takes an override, but at least most of these below seem to ignore it:

    react-native/React/Base/RCTBundleURLProvider.m
    react-native/Libraries/WebSocket/RCTWebSocketExecutor.m
    react-native/React/React.xcodeproj/project.pbxproj

    The others I could probably sort out, despite not being an Objective C programmer, but the last one seems to be new and I don't have the foggiest how to pass in the port as a parameter:

    react-native/React/React.xcodeproj/project.pbxproj

    shellScript = "if nc -w 5 -z localhost 8081 ; then...

    Reacted by Lazar M
  4. perkola commented on Aug 2, 2016

    @perkola
    perkola
    on Aug 2, 2016
    More actions

    These files below also seem to have port 8081 hard-coded in some places.

    react-native/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.java
    react-native/packager/react-packager/src/Server/__tests__/Server-test.js
    react-native/local-cli/util/isPackagerRunning.js
    react-native/Libraries/Image/__tests__/resolveAssetSource-test.js
    
    Reacted by Jason Marshall and Nathan de Paz
  5. hramos
    added
    Documentation
    on Aug 2, 2016
  6. hramos
    self-assigned this
    on Aug 2, 2016
  7. perkola commented on Aug 3, 2016

    @perkola
    perkola
    on Aug 3, 2016
    More actions

    Does this classify as a bug? Or how do i set a custom port that actually works?

    Reacted by Alexander Trauzzi
  8. mkonicek
    closed this as completedon Aug 3, 2016
  9. mkonicek
    reopened this on Aug 3, 2016
  10. perkola commented on Aug 4, 2016

    @perkola
    perkola
    on Aug 4, 2016
    More actions

    Bump. This seems to be a problem with Android as well. Starting the packager on a different port with react-native start --port 8082 worked on v.0.26.* but no longer works on v.0.30.0.

    Reacted by Alonso A. Ortega
  11. MichaelCereda commented on Oct 31, 2016

    @MichaelCereda
    MichaelCereda
    on Oct 31, 2016
    More actions

    This bug should be treated with with high priority, port 8081 is used by some process like McAfee.
    Changing the default port should be easy and painless.

    Reacted by klr, Dheeraj, tanu11, Andrii Chubai and Prithvi Raju Uppalapati
  12. satya164 commented on Oct 31, 2016

    @satya164
    satya164
    on Oct 31, 2016
    Contributor
    More actions

    @MichaelCereda If this is a high priority issue for you, consider sending a PR to fix it.

    Reacted by Lucas Bento and Leonardo Drici
    Reacted by Jason Marshall, Jonathan Caouette, Anup Kale, Pipe Work, Snorre Lothar von Gohren Edwin, Matt Davis, Manan Vaghasiya, Jon Lambert, uvinw, Mykhaylo Ryechkin and 33 more
    Reacted by Alexander Macdonald
    Reacted by Lucas Bento
  13. jdmarshall commented on Oct 31, 2016

    @jdmarshall
    jdmarshall
    on Oct 31, 2016
    Author
    More actions

    I have some deep philosophical problems with suggesting that a feature that mostly affects new users should be fixed in a PR by those new users.

    By all means, let's get esoteric feature requests to file their own PRs. But it comes off as flippant when it's a feature brand new users run into before they even decide if they want to be part of the ecosystem.

    (It's especially grating when that bug is a port conflict. Is this 1996 or 2016?)

    Reacted by Matt Davis, Jonathan Cardoso, Samer Murad, Nancy D'Aquino, ryan dushane, Will Bamford, Adam Weber, Matheus Matos, Rafael Roman, Nicolas Kerdelhué and 12 more
  14. MichaelCereda commented on Nov 1, 2016

    @MichaelCereda
    MichaelCereda
    on Nov 1, 2016
    More actions

    By now the fastest solution is to kill the process (in my case McAfee) and face the web like a real man.
    I always find interesting those type of comments because I have hard time understand if they are a sort of life coaching aimed at the self improvement or mere trolling.

    As @jdmarshall said, I think that is an high priority fix because it discourages new users to adopt react-native that is a framework that I personally love.
    Submitting a PR it's possible but at the same time would require centralize the port number under one configuration file., the problem with this approach is that RN currently uses 3 different environments that should in many ways be independent from external files (that's why the port number has always been hard-coded in at least 2 places).
    The only problem is my opinion that the port RN is using is the 8081 that is one of the most common ever and the risk of conflict is high.
    I'll try to find a solution but suggestions from the team will be highly appreciated.

  15. hramos
    removed
    Documentation
    on Nov 1, 2016
  16. 56 remaining items

  17. nhunzaker commented on Feb 24, 2019

    @nhunzaker
    nhunzaker
    on Feb 24, 2019
    Contributor
    More actions

    I took a stab at this in for Android with #23616

    Reacted by Raúl Gómez
  18. hramos
    added
    Resolution: BacklogAn issue that should be solved at some point, but it's not in the immediate roadmap.
    on Mar 6, 2019
  19. grabbou commented on Mar 19, 2019

    @grabbou
    grabbou
    on Mar 19, 2019
    Contributor
    More actions

    Closing since the original issue is already fixed (you can easily change the port on iOS by setting environmental variables).

    Given the complexity of the native build systems, it's not as easy as it is in JavaScript to just change or auto-detect the port.

    Looks like the Android support is being added thanks to @nhunzaker.

  20. grabbou
    closed this as completedon Mar 19, 2019
  21. react-native-bot
    added
    Bug
    on May 4, 2019
  22. grisaitis commented on May 30, 2019

    @grisaitis
    grisaitis
    on May 30, 2019
    More actions

    Helpful tip: if you encounter the error message 'No bundle URL present' in your iOS emulator, then clean your build folder (ios/build/) and maybe node_modules/ as well. I think the build needs to be completely cleaned and redone any time the port value is changed.

    Reacted by Deg5112
  23. grisaitis commented on May 30, 2019

    @grisaitis
    grisaitis
    on May 30, 2019
    More actions

    Should these environment variables be documented somewhere? I don't see anything in docs or repo READMEs.

  24. nhunzaker
    added a commit that references this issue on Jun 4, 2019

    Allow debug dev server port override

    c28f35c
  25. facebook-github-bot
    added a commit that references this issue on Jun 5, 2019

    Android Fix for 9145: No longer hard code build port (#23616)

    995b4d3
  26. kelset
    added a commit that references this issue on Jun 7, 2019

    Android Fix for 9145: No longer hard code build port (#23616)

    a916dd6
  27. AdamMarcus commented on Oct 12, 2019

    @AdamMarcus
    AdamMarcus
    on Oct 12, 2019
    More actions

    Just wanted to throw out that I am hitting this still while just trying to get through my first react-native demo (in Windows/Android).

  28. TempusFugitful commented on Nov 11, 2019

    @TempusFugitful
    TempusFugitful
    on Nov 11, 2019
    More actions

    Just wanted to throw out that I am hitting this still while just trying to get through my first react-native demo (in Windows/Android).

    I too am still seeing this issue. The "--port" option is seemingly ignored by the "react-native run-ios --port 9000" command, as the Metro Bundler still starts up in port 8081. The "react-native start --port 9000" command does not ignore the "--port" option. So while I can force the metro bundler to open up on a port other than 8081, it does not do so when launched as part of the overall "react-native run-ios" command.

    This still doesn't solve the problem as I then have a react app installed on iOS that expects the default port, while the metro bundler is listening on the new port (if it is started by itself with the "react-native start --port 9000" command).

    Reacted by Erika Pierre and Harshit Mahapatra
  29. M-i-k-e-l
    added a commit that references this issue on Mar 10, 2020

    Android Fix for 9145: No longer hard code build port (react#23616)

    df3ec68
  30. react
    locked as resolved and limited conversation to collaborators on Mar 20, 2020
  31. react-native-bot
    added
    Resolution: LockedThis issue was locked by the bot.
    on Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @hramos
    hramos

Labels

BugGood first issueInterested in collaborating? Take a stab at fixing one of these issues.Help Wanted :octocat:Issues ideal for external contributors.Platform: AndroidAndroid applications.Platform: iOSiOS applications.Ran CommandsOne of our bots successfully processed a command.Resolution: BacklogAn issue that should be solved at some point, but it's not in the immediate roadmap.Resolution: LockedThis issue was locked by the bot.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402792 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.