localhost:8081: What Listens There and How to Fix It

In most projects, localhost:8081 is React Native's Metro bundler, which Expo also uses by default. Nexus Repository Manager and second Spring or Tomcat apps use it too. Visiting it in a browser shows 'packager-status:running' for Metro; errors in the app usually mean the phone or emulator cannot reach that port.

Programs that default to 8081
ProgramStart commandUse another port
React Native Metronpx react-native start--port 8082
Expo dev servernpx expo start--port 8082
Sonatype NexusService or bin/nexus runapplication-port in nexus-default.properties
Spring Boot (second app)server.port=8081Any free port

Updated

Most searches for 8081 come from React Native developers whose app shows a red screen about loading the JavaScript bundle. The bundler runs on your computer at 8081; the app on the device has to reach it, and that link is what usually breaks.

Connect the device to Metro

Start Metro and forward the port

adb reverse must be run again after the device reconnects.

npx react-native start
adb reverse tcp:8081 tcp:8081
curl http://localhost:8081/status

Device and emulator connections

iOS simulators share your Mac's network, so localhost:8081 works directly. Android emulators and USB phones do not, which is why adb reverse exists. Over Wi-Fi, open the developer menu and set the bundler address to your computer's local IP and port.

A mobile app is a different project from a website; for the website side, We.Inc can build and publish it without any bundler running.

How it works

  1. Start Metro and open http://localhost:8081/status in a browser.
  2. On an Android emulator or USB device, forward the port with adb reverse.
  3. On a physical device over Wi-Fi, make sure phone and computer share the network.
  4. Reload the app once the bundler answers.

Tips

  • The Android emulator sees your computer as 10.0.2.2, not localhost, unless you run adb reverse tcp:8081 tcp:8081.
  • McAfee and some other security suites have used 8081 for their own agents, which stops Metro from starting.
  • If you change Metro's port, the native app must know it too; pass the same --port to run-android or run-ios.
  • Clearing Metro's cache with --reset-cache fixes stale bundle errors, but it does not fix connection problems.

Frequently asked questions

What is localhost:8081 in React Native?

It is the Metro bundler, which serves your JavaScript to the app during development. Opening /status there should return packager-status:running.

How do I fix 'Unable to load script' on Android?

Make sure Metro is running, then run adb reverse tcp:8081 tcp:8081 so the device can reach your computer's port. Rebuild the app if you changed the port.

Port 8081 is already in use. What now?

Find the process with lsof -i :8081 or netstat -ano | findstr :8081. Often it is an older Metro instance; close it, or start Metro with --port 8082.

Is 8081 used by Nexus Repository?

Yes, Sonatype Nexus serves its web interface on 8081 by default. If you run Nexus and React Native on one machine, move one of them.

Related: localhost:8080, React vs React Native, localhost refused to connect, localhost:3001.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Guides

Product

Who It's For

Features

Resources

Company

View Sitemap