I'm trying to start the React Native debugger and bundler in port 8088
because 8081
used by another program, using the following command:
react-native run-android --port=8088
The emulator reverse is set correctly
Running C:\Users\MyUser\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8088 tcp:8088
But metro bundler is starting in port 8081
Which would be the best way to start it once some program is reading my 8081 port and I can't stop it.
There are two files needed to be modified about port 8081:
1.react-native/local-cli/server/server.js - default
2.react-native/React/React.xcodeproj/project.pbxproj - replace all the 8081 ports with your desired ports in above two files
Your port will be changed.
I was trying to get my RN app running on port 8088 instead of default port 8081. I've spend almost 2 days to figure out how to do this, but the solutions found were not working in my case. Finally i've found a way to tackle this problem. Follow the 3 steps and get this resolved.
metro.config.js
file, add the following snippet within the module.exports
.server: { port: 8088, }
8088
. I had to do this in the following files for the variable RCT_METRO_PORT
.
- ios/Pods/Headers/Private/React-Core/React/RCTDefines.h
- ios/Pods/Headers/Public/React-Core/React/RCTDefines.h
npx react-native run-ios --port 8088
Thanks!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With