我尝试通过此终端命令在本地启动Flutter Web项目
webdev serve --auto restart
但我收到以下错误消息
Starting resource servers...Unhandled exception:
SocketException: Failed to create server socket (OS Error: Address already in use, errno = 48), address = 127.0.0.1, port = 8080
#0 _NativeSocket.bind (dart:io-patch/socket_patch.dart:591:7)
<asynchronous suspension>
#1 _RawServerSocket.bind (dart:io-patch/socket_patch.dart:1206:26)
#2 _ServerSocket.bind (dart:io-patch/socket_patch.dart:1466:29)
#3 ServerSocket.bind (dart:io-patch/socket_patch.dart:1457:26)
#4 _HttpServer.bind (dart:_http/http_impl.dart:2520:25)
#5 HttpServer.bind (dart:_http:227:19)
#6 HttpMultiServer.loopback.<anonymous closure> (package:http_multi_server/http_multi_server.dart:113:39)
#7 HttpMultiServer._loopback (package:http_multi_server/http_multi_server.dart:172:30)
<asynchronous suspension>
#8 HttpMultiServer.loopback (package:http_multi_server/http_multi_server.dart:111:12)
#9 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:83:33)
#10 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#11 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:54:36)
#12 ServerManager.start (package:webdev/src/serve/server_manager.dart:22:38)
#13 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#14 ServerManager.start (package:webdev/src/serve/server_manager.dart:18:37)
#15 _startServerManager (package:webdev/src/serve/dev_workflow.dart:85:27)
#16 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#17 _startServerManager (package:webdev/src/serve/dev_workflow.dart:66:42)
#18 DevWorkflow.start (package:webdev/src/serve/dev_workflow.dart:186:31)
#19 _RootZone.runUnary (dart:async/zone.dart:1379:54)
#20 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#21 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#22 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#23 Future._complete (dart:async/future_impl.dart:473:7)
#24 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#25 _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async-patch/async_patch.dart:33:20)
#26 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#27 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#28 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#29 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)
abdullah@Abdullahs-MacBook-Pro ~/D/F/web_profile> webdev serve --auto restart
[SEVERE] Deleted previous snapshot due to missing asset graph.
[INFO] Building new asset graph completed, took 1.4s
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Starting resource servers...Unhandled exception:
SocketException: Failed to create server socket (OS Error: Address already in use, errno = 48), address = 127.0.0.1, port = 8080
#0 _NativeSocket.bind (dart:io-patch/socket_patch.dart:591:7)
<asynchronous suspension>
#1 _RawServerSocket.bind (dart:io-patch/socket_patch.dart:1206:26)
#2 _ServerSocket.bind (dart:io-patch/socket_patch.dart:1466:29)
#3 ServerSocket.bind (dart:io-patch/socket_patch.dart:1457:26)
#4 _HttpServer.bind (dart:_http/http_impl.dart:2520:25)
#5 HttpServer.bind (dart:_http:227:19)
#6 HttpMultiServer.loopback.<anonymous closure> (package:http_multi_server/http_multi_server.dart:113:39)
#7 HttpMultiServer._loopback (package:http_multi_server/http_multi_server.dart:172:30)
<asynchronous suspension>
#8 HttpMultiServer.loopback (package:http_multi_server/http_multi_server.dart:111:12)
#9 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:83:33)
#10 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#11 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:54:36)
#12 ServerManager.start (package:webdev/src/serve/server_manager.dart:22:38)
#13 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#14 ServerManager.start (package:webdev/src/serve/server_manager.dart:18:37)
#15 _startServerManager (package:webdev/src/serve/dev_workflow.dart:85:27)
#16 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#17 _startServerManager (package:webdev/src/serve/dev_workflow.dart:66:42)
#18 DevWorkflow.start (package:webdev/src/serve/dev_workflow.dart:186:31)
#19 _RootZone.runUnary (dart:async/zone.dart:1379:54)
#20 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#21 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#22 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#23 Future._complete (dart:async/future_impl.dart:473:7)
#24 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#25 _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async-patch/async_patch.dart:33:20)
#26 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#27 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#28 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#29 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)
abdullah@Abdullahs-MacBook-Pro ~/D/F/web_profile> webdev serve --auto restart
[SEVERE] Deleted previous snapshot due to missing asset graph.
[INFO] Starting resource servers...Unhandled exception:
SocketException: Failed to create server socket (OS Error: Address already in use, errno = 48), address = 127.0.0.1, port = 8080
#0 _NativeSocket.bind (dart:io-patch/socket_patch.dart:591:7)
<asynchronous suspension>
#1 _RawServerSocket.bind (dart:io-patch/socket_patch.dart:1206:26)
#2 _ServerSocket.bind (dart:io-patch/socket_patch.dart:1466:29)
#3 ServerSocket.bind (dart:io-patch/socket_patch.dart:1457:26)
#4 _HttpServer.bind (dart:_http/http_impl.dart:2520:25)
#5 HttpServer.bind (dart:_http:227:19)
#6 HttpMultiServer.loopback.<anonymous closure> (package:http_multi_server/http_multi_server.dart:113:39)
#7 HttpMultiServer._loopback (package:http_multi_server/http_multi_server.dart:172:30)
<asynchronous suspension>
#8 HttpMultiServer.loopback (package:http_multi_server/http_multi_server.dart:111:12)
#9 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:83:33)
#10 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#11 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:54:36)
#12 ServerManager.start (package:webdev/src/serve/server_manager.dart:22:38)
#13 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#14 ServerManager.start (package:webdev/src/serve/server_manager.dart:18:37)
#15 _startServerManager (package:webdev/src/serve/dev_workflow.dart:85:27)
#16 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#17 _startServerManager (package:webdev/src/serve/dev_workflow.dart:66:42)
#18 DevWorkflow.start (package:webdev/src/serve/dev_workflow.dart:186:31)
#19 _RootZone.runUnary (dart:async/zone.dart:1379:54)
#20 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#21 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#22 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
abdullah@Abdullahs-MacBook-Pro ~/D/F/web_profile> webdev serve --auto restart
[SEVERE] Deleted previous snapshot due to missing asset graph.
[INFO] Building new asset graph completed, took 1.3s
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Starting resource servers...Unhandled exception:
SocketException: Failed to create server socket (OS Error: Address already in use, errno = 48), address = 127.0.0.1, port = 8080
#0 _NativeSocket.bind (dart:io-patch/socket_patch.dart:591:7)
<asynchronous suspension>
#1 _RawServerSocket.bind (dart:io-patch/socket_patch.dart:1206:26)
#2 _ServerSocket.bind (dart:io-patch/socket_patch.dart:1466:29)
#3 ServerSocket.bind (dart:io-patch/socket_patch.dart:1457:26)
#4 _HttpServer.bind (dart:_http/http_impl.dart:2520:25)
#5 HttpServer.bind (dart:_http:227:19)
#6 HttpMultiServer.loopback.<anonymous closure> (package:http_multi_server/http_multi_server.dart:113:39)
#7 HttpMultiServer._loopback (package:http_multi_server/http_multi_server.dart:172:30)
<asynchronous suspension>
#8 HttpMultiServer.loopback (package:http_multi_server/http_multi_server.dart:111:12)
#9 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:83:33)
#10 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#11 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:54:36)
#12 ServerManager.start (package:webdev/src/serve/server_manager.dart:22:38)
#13 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#14 ServerManager.start (package:webdev/src/serve/server_manager.dart:18:37)
#15 _startServerManager (package:webdev/src/serve/dev_workflow.dart:85:27)
#16 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#17 _startServerManager (package:webdev/src/serve/dev_workflow.dart:66:42)
#18 DevWorkflow.start (package:webdev/src/serve/dev_workflow.dart:186:31)
#19 _RootZone.runUnary (dart:async/zone.dart:1379:54)
#20 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#21 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#22 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
我试图通过武力从活动监视器退出飞镖过程来解决此问题, 但仍然出现相同的错误
是否有将端口号从8080更改为任何?
还是在给定的默认端口不可用的情况下自动更改为端口号?
答案 0 :(得分:4)
简短回答。
webdev serve web:8082
其中web
是目录名称,而8082
是端口号。