Metro and Port 8081 Problems

React Native uses Metro as its JavaScript bundler during development. By default, Metro runs on http://localhost:8081. When using a physical Android device, the phone must be able to communicate with Metro on the computer.

Problem 1 — Metro is not running

Example:

text
Unable to load script.

Make sure Metro is running or that your device can
connect to the development server.

Start Metro manually:

bash
npx react-native start

You should see something similar to:

text
Welcome to Metro v0.84.4

INFO  Dev server ready.

Keep this terminal open. Then run the application from another terminal:

bash
npx react-native run-android

Problem 2 — Metro is running but says No apps connected

Example:

text
INFO  Reloading connected app(s)...

warn No apps connected.
Sending "reload" to all React Native apps failed.

This does not necessarily mean Metro is broken. It means Metro currently does not have a React Native application connected to it.

First check:

cmd
adb devices

Expected:

text
List of devices attached
192.168.1.15:5555    device

Then make sure the React Native app is actually running on the phone.

Problem 3 — Unable to load script

Example:

text
Unable to load script.

If you're using USB on a physical device, make sure you
also run this command:

adb reverse tcp:8081 tcp:8081

This means the application cannot reach Metro. There are two common ways to solve this:

  1. ADB reverse
  2. Connect directly to the PC's IP address

Method A — ADB Reverse

For a USB-connected device:

cmd
adb reverse tcp:8081 tcp:8081

For a specific device:

cmd
adb -s PHONE_IP:5555 reverse tcp:8081 tcp:8081

Example:

cmd
adb -s 192.168.1.15:5555 reverse tcp:8081 tcp:8081

Check the reverse configuration:

cmd
adb -s 192.168.1.15:5555 reverse --list

Expected output should contain:

text
tcp:8081 tcp:8081
Note

If adb reverse works, the phone does not need to access the PC's 192.168.x.x:8081 address directly. ADB forwards the phone's port 8081 to the computer's port 8081.

Method B — Connect Directly Using the PC IP

This is particularly useful when using wireless ADB.

Find the PC's IPv4 address:

cmd
ipconfig

Example:

text
Wireless LAN adapter Wi-Fi:

   IPv4 Address. . . . . . . : 192.168.1.14
   Subnet Mask . . . . . . . : 255.255.255.0

In this example: PC IP = 192.168.1.14

Do not use the phone's IP. The phone should connect to 192.168.1.14:8081.

Problem 4 — Which IP should be used?

This is an easy mistake to make.

Suppose:

text
Phone: 192.168.1.15
PC:    192.168.1.14

ADB connection

You connect to the phone's IP:

cmd
adb connect 192.168.1.15:5555

Metro connection

The phone connects to the PC's IP:

text
192.168.1.14:8081

So remember:

text
ADB:
PC -> Phone
     |
192.168.1.15:5555

Metro:
Phone -> PC
     |
192.168.1.14:8081

Problem 5 — Test whether the phone can reach Metro

First make sure Metro is running:

bash
npx react-native start

Then find the PC's Wi-Fi IPv4 address:

cmd
ipconfig

For example: 192.168.1.14

On your device, open the browser and enter:

text
http://192.168.1.14:8081

If Metro is accessible, you should see a Metro-related response/page instead of This site can't be reached.

If the page opens

This proves:

  • Phone can reach the PC
  • PC is reachable over the local network
  • Metro is running
  • Port 8081 is reachable

If React Native still says Unable to load script, investigate the React Native server configuration or ADB connection.

If the page does not open

Investigate:

  • Windows Firewall
  • Router restrictions
  • Wi-Fi isolation
  • Whether Metro is actually running
  • Whether the PC and phone are on the same network
  • Whether the PC IP address is correct

Problem 6 — Windows Firewall blocks port 8081

If the phone cannot open http://PC_IP:8081, Windows Firewall may be blocking incoming connections.

Check whether Windows displayed a firewall prompt when Metro/Node.js was first started. If necessary, allow Node.js through Windows Defender Firewall for the appropriate network profile.

You can also check whether something is listening on port 8081:

cmd
netstat -ano | findstr :8081

Example:

text
TCP    0.0.0.0:8081    0.0.0.0:0    LISTENING    12345

LISTENING indicates that a process is listening on port 8081.

Problem 7 — Port 8081 is already in use

Example:

text
Error: listen EADDRINUSE: address already in use :::8081

Find the process:

cmd
netstat -ano | findstr :8081

Example:

text
TCP    0.0.0.0:8081    0.0.0.0:0    LISTENING    12345

The last number is the PID: 12345

Find the process:

cmd
tasklist | findstr 12345

If it is an old Metro/Node process that you no longer need, you can terminate it:

cmd
taskkill /PID 12345 /F

Then start Metro again:

bash
npx react-native start
Warning

Do not terminate a process unless you know what it is.

Problem 8 — Use another Metro port

If port 8081 cannot be used, Metro can run on another port. For example:

bash
npx react-native start --port 8082

Now Metro runs on http://localhost:8082.

The application must also be configured to use the same port. For example, with ADB reverse:

cmd
adb reverse tcp:8082 tcp:8082

Then run the React Native application using the corresponding Metro port.

Note

Changing the Metro port is usually unnecessary unless port 8081 is occupied or there is another specific reason to use a different port.

Problem 9 — adb reverse says more than one device/emulator

Example:

text
adb.exe: error: more than one device/emulator

First check:

cmd
adb devices -l

If multiple devices are listed, specify the phone:

cmd
adb -s 192.168.1.15:5555 reverse tcp:8081 tcp:8081

If only one device appears but ADB still reports more than one device/emulator, check for multiple ADB installations:

cmd
where adb

Also check:

cmd
tasklist | findstr /i "adb scrcpy"

If necessary:

cmd
adb kill-server
adb start-server
adb devices -l

Problem 10 — adb reverse succeeds but Metro still doesn't work

If adb reverse tcp:8081 tcp:8081 succeeds, check that Metro is running:

bash
npx react-native start

Then restart the application.

You can also verify the reverse rule:

cmd
adb reverse --list

Expected:

text
tcp:8081 tcp:8081

If the reverse rule exists but the app still cannot load JavaScript, investigate whether:

  • Metro is running
  • The app is a debug build
  • The correct Metro port is being used
  • A stale application instance is running
  • ADB is connected to the correct device

Problem 11 — Phone browser says This site can't be reached

If the phone shows This site can't be reached when opening http://PC_IP:8081, check the following in order.

1. Check Metro:

bash
npx react-native start

2. Check PC IP:

cmd
ipconfig

Use the Wi-Fi IPv4 address of the PC. Example: PC = 192.168.1.14

3. Check phone IP. Your phone's IP should normally be on the same local network. Example:

text
PC    = 192.168.1.14
Phone = 192.168.1.15

4. Check port 8081 on the PC:

cmd
netstat -ano | findstr :8081

5. Check Windows Firewall. Make sure incoming connections to Metro/Node.js are not being blocked.

6. Check router isolation. Some routers prevent Wi-Fi clients from communicating with each other. Look for settings such as:

text
AP Isolation
Client Isolation
Wireless Isolation

Problem 12 — Airtel router/network restrictions

If both devices are connected to the same Airtel router but Phone -> http://PC_IP:8081 does not work, the router may be preventing communication between wireless clients.

Before changing router settings, test the simpler possibilities:

text
Metro running?
        |
Correct PC IP?
        |
Port 8081 listening?
        |
Windows Firewall?
        |
Same Wi-Fi network?
        |
Router client isolation?

If the browser can open Metro successfully, the router is not blocking that connection.

Problem 13 — Metro starts but the app still uses an old server

If Metro is running on a different port or the app has stale configuration, restart Metro and the application.

Stop Metro: Ctrl + C

Start it again:

bash
npx react-native start

Then restart the app:

bash
npx react-native run-android

For wireless ADB, verify the device first:

cmd
adb devices

Quick Metro Troubleshooting Flow

flowchart TD A[START] --> B{"Is Metro running?"} B -->|NO| C["npx react-native start"] B -->|YES| D["Check device connection"] D --> E["adb devices"] E --> F{"Device = device?"} F -->|NO| G["Fix ADB"] F -->|YES| H{"App launches?"} H -->|NO| I["Check APK installation"] H -->|YES| J{"Unable to load script?"} J -->|No| K["Metro OK"] J -->|Yes| L["Check port 8081"] L --> M{"Which method?"} M -->|"adb reverse tcp:8081"| N{"Works?"} N -->|YES| K N -->|NO| O["Check React Native config"] M -->|"Direct Wi-Fi PC_IP:8081"| P{"Browser test"} P -->|Works| Q["Network OK"] P -->|FAIL| R["Firewall/router/network problem"]

Most Important IP Rule

For wireless React Native development, there are two different IP addresses to remember.

Suppose:

text
PC Wi-Fi IPv4:  192.168.1.14
Device Wi-Fi IPv4: 192.168.1.15

ADB

Use the phone IP:

cmd
adb connect 192.168.1.15:5555

Metro direct connection

Use the PC IP:

text
http://192.168.1.14:8081

Never confuse:

text
Phone IP  -> ADB
PC IP     -> Metro

Important Diagnostic Rule (Metro)

Separate these three problems:

ADB problem

text
adb connect
adb devices
adb reverse

APK installation problem

text
adb install
:app:installDebug
InstallException

Metro problem

text
Unable to load script
No apps connected
Port 8081
Metro

Fix the problem belonging to the stage that actually failed.

Quick Commands (Metro)

Start Metro

bash
npx react-native start

Check port 8081

cmd
netstat -ano | findstr :8081

Check ADB devices

cmd
adb devices -l

ADB reverse

cmd
adb -s PHONE_IP:5555 reverse tcp:8081 tcp:8081

Check reverse rules

cmd
adb -s PHONE_IP:5555 reverse --list

Find PC IP

cmd
ipconfig

Test Metro from phone

Open: http://PC_IP:8081

Run React Native

bash
npx react-native run-android
Important

Most important rule: If the APK installs and launches but shows Unable to load script, stop troubleshooting APK installation. The next thing to investigate is Metro and port 8081 connectivity.