localhost:8081 is port 8081 on your own computer, and it's the default port of the React Native Metro bundler and the Expo dev server. It's also the default for Sonatype Nexus Repository and the obvious next choice when an app on 8080 already holds the usual alternative HTTP port. If a React Native build says it can't connect to the development server, Metro on 8081 is what it's looking for.
What runs on port 8081
| Tool | Default on 8081? | Start command |
|---|---|---|
| React Native Metro bundler | Yes | npx react-native start |
| Expo dev server | Yes | npx expo start |
| Sonatype Nexus Repository | Yes | Service, or docker run -p 8081:8081 sonatype/nexus3 |
| mongo-express | Yes | docker run -p 8081:8081 mongo-express |
| Second web server | By convention | When 8080 is busy |
Metro is a JavaScript bundler, not a web app. Opening http://localhost:8081/status returns packager-status:running when it's healthy.
Fix "could not connect to development server"
- Is Metro running?
npx react-native run-androidnormally starts it in a separate window. If that window closed, start it yourself withnpx react-native start. - Android: map the port. On the emulator or a USB device,
localhostmeans the phone, not your computer. Forward it:adb reverse tcp:8081 tcp:8081
The standard Android emulator can also reach your machine at10.0.2.2:8081. - Physical device on Wi-Fi. Phone and computer must be on the same network, and the firewall must allow 8081. In the React Native dev menu set Debug server host & port to
YOUR-LAN-IP:8081. - iOS simulator. It shares your Mac's network, so
localhost:8081works. If it doesn't, Metro probably isn't running or is on another port. - Stale cache.
npx react-native start --reset-cache(ornpx expo start -c) after dependency changes.
Find and free a busy port 8081
error listen EADDRINUSE: address already in use :::8081 almost always means a Metro from another project is still running.
# macOS / Linux
lsof -i :8081
kill -9 $(lsof -ti :8081)
# Windows
netstat -ano | findstr :8081
taskkill /PID <pid> /F
On some Windows machines antivirus software has been known to hold 8081. If netstat shows a security product, move Metro instead:
npx react-native start --port 8082
npx react-native run-android --port 8082
Expo uses npx expo start --port 8082.
Open localhost:8081 from another device
For Metro, the device-specific steps above are what you need. For Nexus or another HTTP service on 8081, bind it to 0.0.0.0 and open http://YOUR-LAN-IP:8081 from the other machine. Find the IP with ipconfig getifaddr en0 (macOS), hostname -I (Linux) or ipconfig (Windows).
Share 8081 or receive webhooks
You rarely want Metro on the public internet: it serves your app's source to anyone who asks. Expo has its own --tunnel mode for devices that can't reach your LAN.
What mobile developers usually need publicly is the backend. Payment, subscription and push providers send webhooks to your API, and they can't reach localhost. Forward them to the API's local port:
relay forward --bucket mobile-api http://localhost:3000/webhooks
The bucket has a permanent public URL, so you set it in the provider dashboard once. Each request is delivered and logged for replay. For an HTTP service that does belong on a public URL, such as a staging Nexus or a demo API on 8081:
relay connect --name my-service http://localhost:8081
