Expo will not run the app Error: could not connect to TCP port 5554: cannot connect to 127.0.0.1:5554:
Asked Answered
R

6

8

I am using windows 10 and expo 46.0.9. I was trying to have android emulator for expo app project. I installed Android studio and set the path in environment variables. When i run my app in VS code terminal using

npm run start 

and after metro bundling i pressed "a" for android. My AVD mobile appeared on screen but i got following error on the terminal.

Error: could not connect to TCP port 5554: cannot connect to 127.0.0.1:5554: No connection could be made because the target machine actively refused it. (10061)

I followed a youtube tutorial video. Youtube tutorial for emulator. I searched on google but could not find the solution for android studio for expo.

Current result Error picture

Expected results expected results

Royall answered 20/9, 2022 at 9:9 Comment(0)
B
20

I found this solution in another post, try this (it worked for me):

I have just met this issue and noticed that it was happening due to the hanging ADB server. Mine has been solved by running the following commands:

adb kill-server
adb start-server
Bedouin answered 3/11, 2022 at 12:48 Comment(1)
in my case, just killing the process did the jobTillie
F
1

Just wipe the device data and remove node_modules package.

Then

npm install 
npm start

press A and wait it to install app.

(I just try this successfully)

Footgear answered 26/10, 2022 at 2:43 Comment(1)
Yeah. It seems that wipe the data solves the problem. In my case I dropped the virtual device and create another.Obumbrate
A
1

I was struggling on this same issue for 3 days. I knew that something wrong with my port forwarding on 5554 but couldn't find a way to fix. Until I found this answer. https://mcmap.net/q/1322443/-fix-android-studio-react-native-wsl-won-39-t-launch-emulator-with-more-errors

Most of article about running Expo or React Native don't mention about allowing a service in WSL to connect with an emulator on the Windows via emulator port.

Basically you can port-forwarding (which I believe it is) using socat. You can install by sudo apt-get install socat in WSL.

Then run socat -d -d TCP-LISTEN:5554,reuseaddr,fork TCP:$(cat /etc/resolv.conf | tail -n1 | cut -d " " -f 2):5554.

You need to change 5554 to be your emulator's port if it's running on another port. Checking an emulator's port by running adb devices.

Hope it helps someone who struggling this issue in the future.

Aretha answered 7/5, 2023 at 10:48 Comment(1)
This fixed it for me on a Chromebook.Amylase
T
1

in my case, just killing the adb process did the job

Tillie answered 24/5, 2023 at 23:54 Comment(0)
H
0

Just code in the terminal

npm i

and wait for it to install all he required dependencies then restart the project using

yarn start or expo start

Hilversum answered 24/9, 2022 at 5:20 Comment(0)
S
0

I resolved starting from scratch: delete .expo folder and .idea folder.

Sorbitol answered 25/9, 2024 at 13:1 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.