简体   繁体   中英

Appium Question. If “listen eaddrinuse: address already in use”, how to stop it? why it didn't stop?

I had been started Appium using default 0.0.0.0:4723 address and port, but then I got this error:

C:\User\me>appium
[Appium] Welcome to Appium v1.17.0
[HTTP] Could not start REST http interface listener. The requested port may already be in use. Please make sure there is no other instance of this server running already.
Fatal Error: listen EADDRINUSE: address already in use 0.0.0.0:4723
    at Server.setupListenHandle [as _listen2] (net.js:1309:16)
    at listenInCluster (net.js:1357:12)
    at doListen (net.js:1496:7)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)

I found that I can change the port using: appium -p 4724

I also found that I can close connection to 0.0.0.0:4723, if any, whether on the Appium desktop app or a second CMD. I closed Appium desktop app, I stopped and closed any other CMD, but I still got the same Fatal Error: listen EADDRINUSE: address already in use 0.0.0.0:4723

Then my questions: How to stop this already used address? and, Why it didn't stop?

I am ok with using another port to start my server, but shouldn't I be able to simply stop the connection to 4723 port and using it again?

Open a CMD window in Administrator mode by navigating to Start > Run > type cmd > right-click Command Prompt, then select Run as administrator.

C:\Users\admin>netstat -ano|findstr "PID :4723" 
Proto Local Address Foreign Address State PID 
TCP 0.0.0.0:4723 0.0.0.0:0 LISTENING 6134

To kill the process type the PID of the port you want to kill (which will be displayed on the CMD screen) [/f is force]

taskkill /pid 6134 /f

It means that port is already in use. You must kill the process running in that port.

Type following in your command prompt/terminal to get the process ids(PID).

ps aux | grep appium

Then kill that process with following command

kill -9 PID

Alternate process for window:

netstat -ano | findstr :4723
tskill typeyourPIDhere 
taskkill /F /IM node.exe

Instead of remembering and getting to know the process id, just execute the above in command line and Appium service will be ended.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM