> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> warn: UiAutomator did not shut down fast enough, calling it gone
> error: Failed to start an Appium session, err was: Error: Command failed: error: cannot bind to socket
> error: cannot bind to socket
> 
> info: [debug] Cleaning up android objects
> info: [debug] Cleaning up appium session
> info: [debug] Error: Command failed: error: cannot bind to socket
> error: cannot bind to socket
> 
>     at ChildProcess.exithandler (child_process.js:637:15)
>     at ChildProcess.EventEmitter.emit (events.js:98:17)
>     at maybeClose (child_process.js:743:16)
>     at Process.ChildProcess._handle.onexit (child_process.js:810:5)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: error: cannot bind to socket\r\nerror: cannot bind to  socket\r\n)","killed":false,"code":1,"signal":null,"origValue":"Command failed: error: cannot bind to socket\r\nerror: cannot bind to socket\r\n"},"sessionId":null}
> info: <-- POST /wd/hub/session 500 64347.822 ms - 320 
> Killed Node Server.
> Node Server Process Ended

发现这个问题后,想到是不是 port 被占用了。
1:命令:adb nodaemon server
提示 cannot bind 'tcp:5037':
2:命令:netstat -ano | findstr "5037" 发现一个进程占用该 port

但是 kill 掉以后,重新启动,还是会提示 cannot bind to socket

哪位大侠还有遇到这个情况。O(∩_∩) O 谢谢,或者是其他的原因导致啊?


↙↙↙阅读原文可查看相关链接,并与作者交流