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

huangapple go评论68阅读模式
英文:

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

问题

我之前已经使用默认的0.0.0.0:4723地址和端口启动了Appium,但后来我遇到了这个错误:

C:\User\me>appium
[Appium] 欢迎使用 Appium v1.17.0
[HTTP] 无法启动 REST http 接口监听器。所请求的端口可能已经在使用中。请确保没有其他此服务器的实例正在运行。
致命错误:listen EADDRINUSE: 地址已在使用中 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)

我发现我可以通过以下方式更改端口:
appium -p 4724

我还发现,如果存在任何连接到0.0.0.0:4723的情况,无论是在Appium桌面应用程序上还是在第二个命令提示符上,我都可以关闭连接。我关闭了Appium桌面应用程序,我停止并关闭了任何其他命令提示符,但我仍然收到相同的致命错误:listen EADDRINUSE: 地址已在使用中 0.0.0.0:4723

那么我的问题是:如何停止这个已经在使用中的地址?为什么它没有停止?

我可以使用另一个端口来启动我的服务器,但是我不应该能够简单地停止对端口4723的连接并重新使用它吗?

英文:

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?

答案1

得分: 4

以管理员身份打开CMD窗口,方法是转至开始菜单 > 运行 > 输入cmd > 右键单击“命令提示符”,然后选择“以管理员身份运行”。

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

要终止进程,请键入要终止的端口的PID(在CMD屏幕上显示)。
[/f表示强制终止]

taskkill /pid 6134 /f
英文:

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

答案2

得分: 3

这意味着该端口已经在使用中。您必须终止在该端口运行的进程。

在命令提示符/终端中键入以下内容以获取进程 ID(PID)。

ps aux | grep appium

然后使用以下命令终止该进程

kill -9 PID

Windows 的替代方法:

netstat -ano | findstr :4723
tskill 输入您的PID这里
英文:

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 

答案3

得分: 1

taskkill /F /IM node.exe

不需要记住和了解进程 ID,只需在命令行中执行上述命令,Appium 服务将会被终止。

英文:
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.

huangapple
  • 本文由 发表于 2020年4月9日 21:14:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/61122027.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定