Open ajax-sandell-peterman opened 3 years ago
Running into the same exact issue to where I cannot get past this as well and I have tried everything possible to get past it. McAfee is blocking 8081 at within our organization and would be extremely useful if we could override this port setting.
As a workaround you can start Metro separately via yarn start --port ...
and then start the app with npx react-native run-windows --no-packager
. Note that in order to use a non-default port, the app must know to connect to it so you'll have to set the ReactInstanceSettings.SourceBundlePort
We can fix the half where it is passed through. But then the app code will still need to make a private modification. In the meantime the workaround exists.
Using this bug to track fixing that pass through (also make sure to check with iOS/Android for parity of how they handle this passthrough)
Upstream CLI does accept port https://github.com/react-native-community/cli/blob/master/docs/commands.md#run-ios
This is easy enough to work around by changing the port in the dev menu and when starting metro, but sure, the CLI could help with it too.
@jonthysell Is this issue still open to work?
When using React Native Desktop for Windows I'm unable to use
run-windows
to start my app. I get an error in the UI about being unable to load the bundle:Error 80072f78 downloading http://localhost:8081/index.bundle?platform=windows&dev=true&hot=false&inlineSourceMap=true
and the following error in the console:
error listen EADDRINUSE: address already in use :::8081. Run CLI with --verbose flag for more details.
Environment
Steps To Reproduce
npx react-native run-windows
Expected Results
For the app to load without a bundle loading error and console error about port 8081 already being in use.
Based upon this source file (lines 380 and 406) it would seem as though
run-windows
hardcodes the port that Metro runs on. This should ideally be configurable as I have another (legacy) app running on my machine that requires the use of this port and it's not changeable. Is there an environment variable or other way that I'm not aware of that would permit reconfiguration ofrun-windows
to use a different port? Vanilla React Native allows you to pass the--port
argument to change this. Thanks very much for any assistance you might be able to provide!