다시 플러터를 시작한다. 일전에 작심 삼일은 반복되지 말아야 되겠다. 지금 접하는 플러터는 웹 실행이 되어서 웹으로 진행해보고 있는데 실행 시 아래와 같은 에러가 난다.
"SocketException: Failed to create server socket (OS Error: Failed to start accept)"
This application is not configured to build on the web.
To add web support to a project, run `flutter create .`.
Launching lib\main.dart on Chrome in debug mode...
Failed to bind web development server:
SocketException: Failed to create server socket (OS Error: Failed to start accept), address = localhost, port = 50506
#0 _NativeSocket.bind (dart:io-patch/socket_patch.dart:996:7)
<asynchronous suspension>
#1 WebAssetServer.start (package:flutter_tools/src/isolated/devfs_web.dart:204:22)
<asynchronous suspension>
#2 WebDevFS.create (package:flutter_tools/src/isolated/devfs_web.dart:731:22)
<asynchronous suspension>
#3 ResidentWebRunner.run.<anonymous closure> (package:flutter_tools/src/isolated/resident_web_runner.dart:285:25)
<asynchronous suspension>
#4 asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:24)
<asynchronous suspension>
Finished with error: Failed to bind web development server:
SocketException: Failed to create server socket (OS Error: Failed to start accept), address = localhost, port = 50506
address가 localhost로 되어있어서인데 루프백인 127.0.0.1로 변경하면 해결된다. 또는 ipconfig에 나오는 찐 ip로 변경해도 되지만 127.0.0.1을 추천한다.
1) 쉘로 수행하는 경우
$ flutter run -d chrome --web-hostname=127.0.0.1
2) 안드로이드 스튜디오 환경인 경우
Run → Edit Configuration → Additional run args 에 `--web-hostname=127.0.0.1` 값을 추가한다.
--web-hostname=127.0.0.1
'dev > flutter' 카테고리의 다른 글
flutter doctor - android license status unknown (0) | 2019.09.12 |
---|---|
Unable to locate a development device; please run 'flutter doctor' for information about installing additional components (0) | 2019.09.12 |