Every time I try to start my Flutter app with a web target, it fails with "unable to connect to port". I can see that Chrome opens briefly and immediately closes. Here's the error:
GAMACL02JW9615:gurps_trait_parser_app jw9615$ flutter run
Launching lib/main.dart on Chrome in debug mode...
Throwing away cached asset graph due to version mismatch or corrupted asset graph.
Exception: Unable to connect to Chrome debug port: 54686
SocketException: OS Error: Connection refused, errno = 61, address = localhost, port = 54688
#0 throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1 ChromeLauncher._connect (package:flutter_tools/src/web/chrome.dart:139:9)
<asynchronous suspension>
#2 ChromeLauncher.launch (package:flutter_tools/src/web/chrome.dart:120:12)
<asynchronous suspension>
#3 WebFs.start (package:flutter_tools/src/build_runner/web_fs.dart:232:48)
<asynchronous suspension>
#4 ResidentWebRunner.run (package:flutter_tools/src/build_runner/resident_web_runner.dart:161:34)
<asynchronous suspension>
#5 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:460:37)
<asynchronous suspension>
#6 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
#7 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#8 _rootRunUnary (dart:async/zone.dart:1132:38)
#9 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#10 _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#11 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#12 Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#13 Future._completeWithValue (dart:async/future_impl.dart:522:5)
#14 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#15 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#16 RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
#17 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#18 _rootRunUnary (dart:async/zone.dart:1132:38)
#19 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#20 _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#21 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#22 Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#23 Future._completeWithValue (dart:async/future_impl.dart:522:5)
#24 Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#25 _rootRun (dart:async/zone.dart:1124:13)
#26 _CustomZone.run (dart:async/zone.dart:1021:19)
#27 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#28 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#29 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#30 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#31 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#32 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
Building application for the web... 20.2s
Failed to build application for the web.
GAMACL02JW9615:gurps_trait_parser_app jw9615$ flutter doctor -v
[✓] Flutter (Channel master, v1.10.2-pre.22, on Mac OS X 10.14.6 18G95, locale en-US)
• Flutter version 1.10.2-pre.22 at /Users/jw9615/Personal/git/flutter
• Framework revision a7c06e113b (4 hours ago), 2019-09-10 10:29:58 -0700
• Engine revision 7ea9884ab0
• Dart version 2.5.0 (build 2.5.0-dev.4.0 be66176534)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/jw9615/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.3, Build version 10G8
• CocoaPods version 1.7.5
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 31.1.1
• Dart plugin version 181.5656
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] IntelliJ IDEA Community Edition (version 2018.3.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 31.3.4
• Dart plugin version 183.4886.3
[✓] VS Code (version 1.38.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.4.1
[✓] Connected device (1 available)
• Chrome • chrome • web-javascript • Google Chrome 76.0.3809.132
• No issues found!
GAMACL02JW9615:gurps_trait_parser_app jw9615$ flutter config
Configure Flutter settings.
To remove a setting, configure it to an empty string.
Usage: flutter config [arguments]
-h, --help Print this usage information.
--[no-]analytics Enable or disable reporting anonymously tool usage statistics and crash reports.
--clear-ios-signing-cert Clear the saved development certificate choice used to sign apps for iOS device deployment.
--android-sdk The Android SDK directory.
--android-studio-dir The Android Studio install directory.
--build-dir=<out/> The relative path to override a projects build directory
--[no-]enable-web Enable or disable Flutter for web. This setting will take effect on the master and dev channels.
--[no-]enable-linux-desktop Enable or disable Flutter for desktop on Linux. This setting will take effect on the master channel.
--[no-]enable-macos-desktop Enable or disable Flutter for desktop on macOS. This setting will take effect on the master channel.
--[no-]enable-windows-desktop Enable or disable Flutter for desktop on Windows. This setting will take effect on the master channel.
--[no-]enable-build-plugin-as-aar Enable or disable Build plugins independently as AARs in app projects. This setting will take effect on the master channel.
--clear-features Remove all configured features and restore them to the default values.
Run "flutter help" to see global options.
Settings:
enable-web: true
Analytics reporting is currently enabled.