[{"data":1,"prerenderedAt":821},["ShallowReactive",2],{"content-query-Kkz7eKisGS":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"layout":10,"crumb":11,"summary":12,"group":13,"order":14,"port":15,"updated":16,"cta":17,"related":25,"faq":44,"body":57,"_type":814,"_id":815,"_source":816,"_file":817,"_stem":818,"_extension":819,"sitemap":820},"/localhost/8081","localhost",false,"","localhost:8081: React Native Metro, Expo and alt HTTP port","localhost:8081 is the React Native Metro bundler and Expo dev server port, plus Nexus and alt HTTP. Fix 'port 8081 already in use' and connect a device.","reference","localhost:8081","React Native Metro, Expo, Nexus Repository, second HTTP server.","Web frameworks",8,8081,"2026-10-28",{"eyebrow":18,"title":19,"text":20,"to":21,"label":22,"secondaryTo":23,"secondaryLabel":24},"Webhook Relay","Test push and payment webhooks from your mobile app's backend","Metro only serves JavaScript. The webhooks your app depends on (Stripe, RevenueCat, push providers) go to your API. relay forward gives that API a permanent public URL on localhost, and relay connect shares any local port over HTTPS.","/docs/webhooks/internal/localhost/","Receive webhooks locally","/tunnels/","Explore Tunnels",[26,29,32,35,38,41],{"title":27,"to":28},"localhost:8080","/localhost/8080/",{"title":30,"to":31},"localhost:3000","/localhost/3000/",{"title":33,"to":34},"localhost:3001","/localhost/3001/",{"title":36,"to":37},"127.0.0.1 and the loopback address","/localhost/127-0-0-1/",{"title":39,"to":40},"What is a tunnel?","/glossary/tunnel/",{"title":42,"to":43},"What is a webhook URL?","/glossary/webhook-url/",[45,48,51,54],{"q":46,"a":47},"What is localhost:8081?","localhost:8081 is port 8081 on your own machine. It is the default port of the React Native Metro bundler and the Expo dev server, the default for Sonatype Nexus Repository, and the usual fallback HTTP port when something already occupies 8080.",{"q":49,"a":50},"How do I fix port 8081 already in use in React Native?","Another Metro instance is usually still running. Find it with lsof -i :8081 and stop it with kill -9 PID, or start Metro on another port with npx react-native start --port 8082 and build the app with the matching port.",{"q":52,"a":53},"How does the Android emulator reach Metro on localhost:8081?","Inside the Android emulator, localhost is the emulator itself. Run adb reverse tcp:8081 tcp:8081 so the device's port 8081 is forwarded to your computer, or use the special host address 10.0.2.2, which points to the host machine from the standard emulator.",{"q":55,"a":56},"What does localhost:8081 show in a browser?","With Metro running, http://localhost:8081/status returns packager-status:running. Metro serves JavaScript bundles to the app, not a website.",{"type":58,"children":59,"toc":807},"root",[60,92,99,237,258,264,429,435,446,521,554,567,626,638,644,689,695,708,727,762,767,801],{"type":61,"tag":62,"props":63,"children":64},"element","p",{},[65,78,80,90],{"type":61,"tag":66,"props":67,"children":68},"strong",{},[69,76],{"type":61,"tag":70,"props":71,"children":73},"code",{"className":72},[],[74],{"type":75,"value":11},"text",{"type":75,"value":77}," is port 8081 on your own computer, and it's the default port of the React Native Metro bundler and the Expo dev server.",{"type":75,"value":79}," It's also the default for Sonatype Nexus Repository and the obvious next choice when an app on ",{"type":61,"tag":81,"props":82,"children":83},"a",{"href":28},[84],{"type":61,"tag":70,"props":85,"children":87},{"className":86},[],[88],{"type":75,"value":89},"8080",{"type":75,"value":91}," 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.",{"type":61,"tag":93,"props":94,"children":96},"h2",{"id":95},"what-runs-on-port-8081",[97],{"type":75,"value":98},"What runs on port 8081",{"type":61,"tag":100,"props":101,"children":102},"table",{},[103,127],{"type":61,"tag":104,"props":105,"children":106},"thead",{},[107],{"type":61,"tag":108,"props":109,"children":110},"tr",{},[111,117,122],{"type":61,"tag":112,"props":113,"children":114},"th",{},[115],{"type":75,"value":116},"Tool",{"type":61,"tag":112,"props":118,"children":119},{},[120],{"type":75,"value":121},"Default on 8081?",{"type":61,"tag":112,"props":123,"children":124},{},[125],{"type":75,"value":126},"Start command",{"type":61,"tag":128,"props":129,"children":130},"tbody",{},[131,154,175,198,219],{"type":61,"tag":108,"props":132,"children":133},{},[134,140,145],{"type":61,"tag":135,"props":136,"children":137},"td",{},[138],{"type":75,"value":139},"React Native Metro bundler",{"type":61,"tag":135,"props":141,"children":142},{},[143],{"type":75,"value":144},"Yes",{"type":61,"tag":135,"props":146,"children":147},{},[148],{"type":61,"tag":70,"props":149,"children":151},{"className":150},[],[152],{"type":75,"value":153},"npx react-native start",{"type":61,"tag":108,"props":155,"children":156},{},[157,162,166],{"type":61,"tag":135,"props":158,"children":159},{},[160],{"type":75,"value":161},"Expo dev server",{"type":61,"tag":135,"props":163,"children":164},{},[165],{"type":75,"value":144},{"type":61,"tag":135,"props":167,"children":168},{},[169],{"type":61,"tag":70,"props":170,"children":172},{"className":171},[],[173],{"type":75,"value":174},"npx expo start",{"type":61,"tag":108,"props":176,"children":177},{},[178,183,187],{"type":61,"tag":135,"props":179,"children":180},{},[181],{"type":75,"value":182},"Sonatype Nexus Repository",{"type":61,"tag":135,"props":184,"children":185},{},[186],{"type":75,"value":144},{"type":61,"tag":135,"props":188,"children":189},{},[190,192],{"type":75,"value":191},"Service, or ",{"type":61,"tag":70,"props":193,"children":195},{"className":194},[],[196],{"type":75,"value":197},"docker run -p 8081:8081 sonatype/nexus3",{"type":61,"tag":108,"props":199,"children":200},{},[201,206,210],{"type":61,"tag":135,"props":202,"children":203},{},[204],{"type":75,"value":205},"mongo-express",{"type":61,"tag":135,"props":207,"children":208},{},[209],{"type":75,"value":144},{"type":61,"tag":135,"props":211,"children":212},{},[213],{"type":61,"tag":70,"props":214,"children":216},{"className":215},[],[217],{"type":75,"value":218},"docker run -p 8081:8081 mongo-express",{"type":61,"tag":108,"props":220,"children":221},{},[222,227,232],{"type":61,"tag":135,"props":223,"children":224},{},[225],{"type":75,"value":226},"Second web server",{"type":61,"tag":135,"props":228,"children":229},{},[230],{"type":75,"value":231},"By convention",{"type":61,"tag":135,"props":233,"children":234},{},[235],{"type":75,"value":236},"When 8080 is busy",{"type":61,"tag":62,"props":238,"children":239},{},[240,242,248,250,256],{"type":75,"value":241},"Metro is a JavaScript bundler, not a web app. Opening ",{"type":61,"tag":70,"props":243,"children":245},{"className":244},[],[246],{"type":75,"value":247},"http://localhost:8081/status",{"type":75,"value":249}," returns ",{"type":61,"tag":70,"props":251,"children":253},{"className":252},[],[254],{"type":75,"value":255},"packager-status:running",{"type":75,"value":257}," when it's healthy.",{"type":61,"tag":93,"props":259,"children":261},{"id":260},"fix-could-not-connect-to-development-server",[262],{"type":75,"value":263},"Fix \"could not connect to development server\"",{"type":61,"tag":265,"props":266,"children":267},"ol",{},[268,294,362,387,404],{"type":61,"tag":269,"props":270,"children":271},"li",{},[272,277,279,285,287,292],{"type":61,"tag":66,"props":273,"children":274},{},[275],{"type":75,"value":276},"Is Metro running?",{"type":75,"value":278}," ",{"type":61,"tag":70,"props":280,"children":282},{"className":281},[],[283],{"type":75,"value":284},"npx react-native run-android",{"type":75,"value":286}," normally starts it in a separate window. If that window closed, start it yourself with ",{"type":61,"tag":70,"props":288,"children":290},{"className":289},[],[291],{"type":75,"value":153},{"type":75,"value":293},".",{"type":61,"tag":269,"props":295,"children":296},{},[297,302,304,309,311,349,353,355,361],{"type":61,"tag":66,"props":298,"children":299},{},[300],{"type":75,"value":301},"Android: map the port.",{"type":75,"value":303}," On the emulator or a USB device, ",{"type":61,"tag":70,"props":305,"children":307},{"className":306},[],[308],{"type":75,"value":5},{"type":75,"value":310}," means the phone, not your computer. Forward it:",{"type":61,"tag":312,"props":313,"children":317},"pre",{"className":314,"code":315,"language":316,"meta":7,"style":7},"language-bash shiki shiki-themes github-dark","adb reverse tcp:8081 tcp:8081\n","bash",[318],{"type":61,"tag":70,"props":319,"children":320},{"__ignoreMap":7},[321],{"type":61,"tag":322,"props":323,"children":326},"span",{"class":324,"line":325},"line",1,[327,333,339,344],{"type":61,"tag":322,"props":328,"children":330},{"style":329},"--shiki-default:#B392F0",[331],{"type":75,"value":332},"adb",{"type":61,"tag":322,"props":334,"children":336},{"style":335},"--shiki-default:#9ECBFF",[337],{"type":75,"value":338}," reverse",{"type":61,"tag":322,"props":340,"children":341},{"style":335},[342],{"type":75,"value":343}," tcp:8081",{"type":61,"tag":322,"props":345,"children":346},{"style":335},[347],{"type":75,"value":348}," tcp:8081\n",{"type":61,"tag":350,"props":351,"children":352},"br",{},[],{"type":75,"value":354},"The standard Android emulator can also reach your machine at ",{"type":61,"tag":70,"props":356,"children":358},{"className":357},[],[359],{"type":75,"value":360},"10.0.2.2:8081",{"type":75,"value":293},{"type":61,"tag":269,"props":363,"children":364},{},[365,370,372,378,380,386],{"type":61,"tag":66,"props":366,"children":367},{},[368],{"type":75,"value":369},"Physical device on Wi-Fi.",{"type":75,"value":371}," Phone and computer must be on the same network, and the firewall must allow 8081. In the React Native dev menu set ",{"type":61,"tag":373,"props":374,"children":375},"em",{},[376],{"type":75,"value":377},"Debug server host & port",{"type":75,"value":379}," to ",{"type":61,"tag":70,"props":381,"children":383},{"className":382},[],[384],{"type":75,"value":385},"YOUR-LAN-IP:8081",{"type":75,"value":293},{"type":61,"tag":269,"props":388,"children":389},{},[390,395,397,402],{"type":61,"tag":66,"props":391,"children":392},{},[393],{"type":75,"value":394},"iOS simulator.",{"type":75,"value":396}," It shares your Mac's network, so ",{"type":61,"tag":70,"props":398,"children":400},{"className":399},[],[401],{"type":75,"value":11},{"type":75,"value":403}," works. If it doesn't, Metro probably isn't running or is on another port.",{"type":61,"tag":269,"props":405,"children":406},{},[407,412,413,419,421,427],{"type":61,"tag":66,"props":408,"children":409},{},[410],{"type":75,"value":411},"Stale cache.",{"type":75,"value":278},{"type":61,"tag":70,"props":414,"children":416},{"className":415},[],[417],{"type":75,"value":418},"npx react-native start --reset-cache",{"type":75,"value":420}," (or ",{"type":61,"tag":70,"props":422,"children":424},{"className":423},[],[425],{"type":75,"value":426},"npx expo start -c",{"type":75,"value":428},") after dependency changes.",{"type":61,"tag":93,"props":430,"children":432},{"id":431},"find-and-free-a-busy-port-8081",[433],{"type":75,"value":434},"Find and free a busy port 8081",{"type":61,"tag":62,"props":436,"children":437},{},[438,444],{"type":61,"tag":70,"props":439,"children":441},{"className":440},[],[442],{"type":75,"value":443},"error listen EADDRINUSE: address already in use :::8081",{"type":75,"value":445}," almost always means a Metro from another project is still running.",{"type":61,"tag":312,"props":447,"children":449},{"className":314,"code":448,"language":316,"meta":7,"style":7},"# macOS / Linux\nlsof -i :8081\nkill -9 $(lsof -ti :8081)\n",[450],{"type":61,"tag":70,"props":451,"children":452},{"__ignoreMap":7},[453,462,482],{"type":61,"tag":322,"props":454,"children":455},{"class":324,"line":325},[456],{"type":61,"tag":322,"props":457,"children":459},{"style":458},"--shiki-default:#6A737D",[460],{"type":75,"value":461},"# macOS / Linux\n",{"type":61,"tag":322,"props":463,"children":465},{"class":324,"line":464},2,[466,471,477],{"type":61,"tag":322,"props":467,"children":468},{"style":329},[469],{"type":75,"value":470},"lsof",{"type":61,"tag":322,"props":472,"children":474},{"style":473},"--shiki-default:#79B8FF",[475],{"type":75,"value":476}," -i",{"type":61,"tag":322,"props":478,"children":479},{"style":335},[480],{"type":75,"value":481}," :8081\n",{"type":61,"tag":322,"props":483,"children":485},{"class":324,"line":484},3,[486,491,496,502,506,511,516],{"type":61,"tag":322,"props":487,"children":488},{"style":473},[489],{"type":75,"value":490},"kill",{"type":61,"tag":322,"props":492,"children":493},{"style":473},[494],{"type":75,"value":495}," -9",{"type":61,"tag":322,"props":497,"children":499},{"style":498},"--shiki-default:#E1E4E8",[500],{"type":75,"value":501}," $(",{"type":61,"tag":322,"props":503,"children":504},{"style":329},[505],{"type":75,"value":470},{"type":61,"tag":322,"props":507,"children":508},{"style":473},[509],{"type":75,"value":510}," -ti",{"type":61,"tag":322,"props":512,"children":513},{"style":335},[514],{"type":75,"value":515}," :8081",{"type":61,"tag":322,"props":517,"children":518},{"style":498},[519],{"type":75,"value":520},")\n",{"type":61,"tag":312,"props":522,"children":526},{"className":523,"code":524,"language":525,"meta":7,"style":7},"language-powershell shiki shiki-themes github-dark","# Windows\nnetstat -ano | findstr :8081\ntaskkill /PID \u003Cpid> /F\n","powershell",[527],{"type":61,"tag":70,"props":528,"children":529},{"__ignoreMap":7},[530,538,546],{"type":61,"tag":322,"props":531,"children":532},{"class":324,"line":325},[533],{"type":61,"tag":322,"props":534,"children":535},{},[536],{"type":75,"value":537},"# Windows\n",{"type":61,"tag":322,"props":539,"children":540},{"class":324,"line":464},[541],{"type":61,"tag":322,"props":542,"children":543},{},[544],{"type":75,"value":545},"netstat -ano | findstr :8081\n",{"type":61,"tag":322,"props":547,"children":548},{"class":324,"line":484},[549],{"type":61,"tag":322,"props":550,"children":551},{},[552],{"type":75,"value":553},"taskkill /PID \u003Cpid> /F\n",{"type":61,"tag":62,"props":555,"children":556},{},[557,559,565],{"type":75,"value":558},"On some Windows machines antivirus software has been known to hold 8081. If ",{"type":61,"tag":70,"props":560,"children":562},{"className":561},[],[563],{"type":75,"value":564},"netstat",{"type":75,"value":566}," shows a security product, move Metro instead:",{"type":61,"tag":312,"props":568,"children":570},{"className":314,"code":569,"language":316,"meta":7,"style":7},"npx react-native start --port 8082\nnpx react-native run-android --port 8082\n",[571],{"type":61,"tag":70,"props":572,"children":573},{"__ignoreMap":7},[574,602],{"type":61,"tag":322,"props":575,"children":576},{"class":324,"line":325},[577,582,587,592,597],{"type":61,"tag":322,"props":578,"children":579},{"style":329},[580],{"type":75,"value":581},"npx",{"type":61,"tag":322,"props":583,"children":584},{"style":335},[585],{"type":75,"value":586}," react-native",{"type":61,"tag":322,"props":588,"children":589},{"style":335},[590],{"type":75,"value":591}," start",{"type":61,"tag":322,"props":593,"children":594},{"style":473},[595],{"type":75,"value":596}," --port",{"type":61,"tag":322,"props":598,"children":599},{"style":473},[600],{"type":75,"value":601}," 8082\n",{"type":61,"tag":322,"props":603,"children":604},{"class":324,"line":464},[605,609,613,618,622],{"type":61,"tag":322,"props":606,"children":607},{"style":329},[608],{"type":75,"value":581},{"type":61,"tag":322,"props":610,"children":611},{"style":335},[612],{"type":75,"value":586},{"type":61,"tag":322,"props":614,"children":615},{"style":335},[616],{"type":75,"value":617}," run-android",{"type":61,"tag":322,"props":619,"children":620},{"style":473},[621],{"type":75,"value":596},{"type":61,"tag":322,"props":623,"children":624},{"style":473},[625],{"type":75,"value":601},{"type":61,"tag":62,"props":627,"children":628},{},[629,631,637],{"type":75,"value":630},"Expo uses ",{"type":61,"tag":70,"props":632,"children":634},{"className":633},[],[635],{"type":75,"value":636},"npx expo start --port 8082",{"type":75,"value":293},{"type":61,"tag":93,"props":639,"children":641},{"id":640},"open-localhost8081-from-another-device",[642],{"type":75,"value":643},"Open localhost:8081 from another device",{"type":61,"tag":62,"props":645,"children":646},{},[647,649,655,657,663,665,671,673,679,681,687],{"type":75,"value":648},"For Metro, the device-specific steps above are what you need. For Nexus or another HTTP service on 8081, bind it to ",{"type":61,"tag":70,"props":650,"children":652},{"className":651},[],[653],{"type":75,"value":654},"0.0.0.0",{"type":75,"value":656}," and open ",{"type":61,"tag":70,"props":658,"children":660},{"className":659},[],[661],{"type":75,"value":662},"http://YOUR-LAN-IP:8081",{"type":75,"value":664}," from the other machine. Find the IP with ",{"type":61,"tag":70,"props":666,"children":668},{"className":667},[],[669],{"type":75,"value":670},"ipconfig getifaddr en0",{"type":75,"value":672}," (macOS), ",{"type":61,"tag":70,"props":674,"children":676},{"className":675},[],[677],{"type":75,"value":678},"hostname -I",{"type":75,"value":680}," (Linux) or ",{"type":61,"tag":70,"props":682,"children":684},{"className":683},[],[685],{"type":75,"value":686},"ipconfig",{"type":75,"value":688}," (Windows).",{"type":61,"tag":93,"props":690,"children":692},{"id":691},"share-8081-or-receive-webhooks",[693],{"type":75,"value":694},"Share 8081 or receive webhooks",{"type":61,"tag":62,"props":696,"children":697},{},[698,700,706],{"type":75,"value":699},"You rarely want Metro on the public internet: it serves your app's source to anyone who asks. Expo has its own ",{"type":61,"tag":70,"props":701,"children":703},{"className":702},[],[704],{"type":75,"value":705},"--tunnel",{"type":75,"value":707}," mode for devices that can't reach your LAN.",{"type":61,"tag":62,"props":709,"children":710},{},[711,713,718,720,725],{"type":75,"value":712},"What mobile developers usually need publicly is the ",{"type":61,"tag":66,"props":714,"children":715},{},[716],{"type":75,"value":717},"backend",{"type":75,"value":719},". Payment, subscription and push providers send webhooks to your API, and they can't reach ",{"type":61,"tag":70,"props":721,"children":723},{"className":722},[],[724],{"type":75,"value":5},{"type":75,"value":726},". Forward them to the API's local port:",{"type":61,"tag":312,"props":728,"children":730},{"className":314,"code":729,"language":316,"meta":7,"style":7},"relay forward --bucket mobile-api http://localhost:3000/webhooks\n",[731],{"type":61,"tag":70,"props":732,"children":733},{"__ignoreMap":7},[734],{"type":61,"tag":322,"props":735,"children":736},{"class":324,"line":325},[737,742,747,752,757],{"type":61,"tag":322,"props":738,"children":739},{"style":329},[740],{"type":75,"value":741},"relay",{"type":61,"tag":322,"props":743,"children":744},{"style":335},[745],{"type":75,"value":746}," forward",{"type":61,"tag":322,"props":748,"children":749},{"style":473},[750],{"type":75,"value":751}," --bucket",{"type":61,"tag":322,"props":753,"children":754},{"style":335},[755],{"type":75,"value":756}," mobile-api",{"type":61,"tag":322,"props":758,"children":759},{"style":335},[760],{"type":75,"value":761}," http://localhost:3000/webhooks\n",{"type":61,"tag":62,"props":763,"children":764},{},[765],{"type":75,"value":766},"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:",{"type":61,"tag":312,"props":768,"children":770},{"className":314,"code":769,"language":316,"meta":7,"style":7},"relay connect --name my-service http://localhost:8081\n",[771],{"type":61,"tag":70,"props":772,"children":773},{"__ignoreMap":7},[774],{"type":61,"tag":322,"props":775,"children":776},{"class":324,"line":325},[777,781,786,791,796],{"type":61,"tag":322,"props":778,"children":779},{"style":329},[780],{"type":75,"value":741},{"type":61,"tag":322,"props":782,"children":783},{"style":335},[784],{"type":75,"value":785}," connect",{"type":61,"tag":322,"props":787,"children":788},{"style":473},[789],{"type":75,"value":790}," --name",{"type":61,"tag":322,"props":792,"children":793},{"style":335},[794],{"type":75,"value":795}," my-service",{"type":61,"tag":322,"props":797,"children":798},{"style":335},[799],{"type":75,"value":800}," http://localhost:8081\n",{"type":61,"tag":802,"props":803,"children":804},"style",{},[805],{"type":75,"value":806},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":484,"depth":484,"links":808},[809,810,811,812,813],{"id":95,"depth":464,"text":98},{"id":260,"depth":464,"text":263},{"id":431,"depth":464,"text":434},{"id":640,"depth":464,"text":643},{"id":691,"depth":464,"text":694},"markdown","content:localhost:8081.md","content","localhost/8081.md","localhost/8081","md",{"loc":4},1793199809354]