尝试为flutter

编程入门 行业动态 更新时间:2024-10-25 22:23:56
本文介绍了尝试为flutter_web项目提供服务时无法创建本地服务器(地址已在使用中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试通过此终端命令在本地启动Flutter Web项目

i tried launch the flutter web project locally by this terminal command

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 _SyncCompleterplete (dart:async/future_impl.dart:51:12) #25 _AsyncAwaitCompleterplete.<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 _SyncCompleterplete (dart:async/future_impl.dart:51:12) #25 _AsyncAwaitCompleterplete.<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)

我试图通过武力从活动监视器退出飞镖过程来解决此问题, 但仍然出现相同的错误

my attempts to solve this problem by force quit the dart process from activity monitor , but still i get same error

反正可以将端口号从8080更改为任何吗?

is there anyway to change the port number from 8080 to any ?

还是在给定的默认端口不可用的情况下自动更改为端口号?

or anyway to change to port number automatically if given default port is not available ?

推荐答案

简短答案.

webdev serve web:8082

其中web是目录名称,8082是端口号.

Where web is a directory name and 8082 is a port number.

更多推荐

尝试为flutter

本文发布于:2023-08-07 03:37:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1316751.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:flutter

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!