Flutter 报错原因:SocketException: Failed to create server socket (OS Error: Failed to start accept), address = localhost, port = xxxx

RAM*_*RAM 5 flutter

当我运行flutter run -d chrome命令( ref ) 时,出现Failed to start accept错误:

SocketException: Failed to create server socket (OS Error: Failed to start accept), address = localhost, port = 6670
Run Code Online (Sandbox Code Playgroud)

附加信息:

flutter channel => beta
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

Dav*_* B. 7

好的,这也是我的问题,我设法找到解决方法

  1. 在cmd上运行“ipconfig”

  2. 运行“ipconfig”后获取 IPv4 地址的值。

  3. 然后在应用程序上运行:

    flutter run -d chrome --web-port=8080 --web-hostname= *the value of IPv4 Address*
    
    Run Code Online (Sandbox Code Playgroud)