webdev build构建可以成功通过:
PS D:\www\flutter_web_demo> webdev build
[INFO] Reading cached asset graph completed, took 242ms
[INFO] Checking for updates since last build completed, took 694ms
[INFO] Running build completed, took 235ms
[INFO] Caching finalized dependency graph completed, took 123ms
[INFO] Reading manifest at build\.build.manifest completed, took 16ms
[INFO] Deleting previous outputs in `build` completed, took 569ms
[INFO] Creating merged output dir `build` completed, took 2.9s
[INFO] Writing asset manifest completed, took 153ms
[INFO] Succeeded after 4.3s with 0 outputs (0 actions)
执行运行指令不能成功:
PS D:\www\flutter_web_demo> webdev serve
[INFO] Reading cached asset graph completed, took 361ms
[INFO] Checking for updates since last build completed, took 923ms
[INFO] Starting resource servers...Unhandled exception:
SocketException: Failed to create server socket (OS Error: Failed to start accept), address = localhost, 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 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:81:26)
#7 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#8 WebDevServer.start (package:webdev/src/serve/webdev_server.dart:53:36)
#9 ServerManager.start (package:webdev/src/serve/server_manager.dart:22:38)
#10 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#11 ServerManager.start (package:webdev/src/serve/server_manager.dart:18:37)
#12 _startServerManager (package:webdev/src/serve/dev_workflow.dart:85:27)
#13 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:49:6)
#14 _startServerManager (package:webdev/src/serve/dev_workflow.dart:66:42)
#15 DevWorkflow.start (package:webdev/src/serve/dev_workflow.dart:186:31)
#16 _RootZone.runUnary (dart:async/zone.dart:1379:54)
#17 _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
#18 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
#19 Future._propagateToListeners (dart:async/future_impl.dart:668:32)
#20 Future._complete (dart:async/future_impl.dart:473:7)
#21 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#22 _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async-patch/async_patch.dart:33:20)
#23 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#24 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#25 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)
#26 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:5)
初步认为可能是配置原因或缺少资源引用。
通过日志分析不出问题所在,通过网络也找不到相似的问题及解决方案,盼有 flutter web 开发经验的大神指导!
把启动默认参数主机地址改下, webdev serve --hostname 127.0.0.1