Running Multiple React-Native Dev Servers.

Eranga Dulshan
3 min readApr 29, 2020
Photo by Daniel Korpai on Unsplash

When you run react-native run-android or react-native run-ios it starts the bundler on port 8081 and install the app on emulator or simulator or device. When one process is running on a port, we can not start another on the same port. So what if you want to develop two react-native apps at the same time. Here is the process.

You can run one metro bundler on default 8081 by running

react-native run-android

for android and

react-native run-ios

on ios. It will also install the app on emulator or device.

You can run a different metro bundler (other app that you want to build) on a different port (let’s say port 8082) using following command.

react-native start — port 8082

Spot the difference that this will only start the metro bundler without installing the app on an emulator or on a device. So, what you can do is running react-native run-android or react-native run-ios (depending on platform that you are developing) on the second project folder too. That will install the app on emulator/s or device/s (you can use multiple emulators or devices if you like).

Then find the last installed app on emulator/s or device/s and open it. Get the following screen by shaking the device or tapping the menu.

Then in the Settings menu, you will have the debug server host and port option.

In that, you can set the ip and port of the metro bundler for the second app.

For example: 192.168.8.100:8082

Do not use localhost or 127.0.0.1 since that is local to the device or emulator. Always use the ip of the machine that you are developing the apps. Now if you reload the app, the second app will request bundle from the 8082 metro bundler. And the first one will request from the 8081 by default. Like wise you can develop many apps in react-native at the same time.

Happy Coding 😄

--

--