Skip to content

Cannot launch DevTools without having Chrome installed #1760

Closed

Description

@aircircle

Flutter app is in debug mode, run "Dart: Open DevTools" command in command palette, it alert below error message "The DevTools service failed to launch the browser. Please raise a bug against the Dart extension for VS Code." pls help check and share a solution to fix it. Thanks in advance~

Activity

  1. DanTup commented on May 29, 2019

    @DanTup
    Member

    Can you click Help -> Toggle Dev Tools in VS Code and see if there's a full error+stack in the Console tab?

    Also - do you see this with the simulator or a real device?

    Can you also include the output of running flutter packages global list from a terminal.

    Thanks!

  2. added
    awaiting infoRequires more information from the customer to progress
    on May 29, 2019
  3. aircircle commented on May 29, 2019

    @aircircle
    Author

    Debug with simulator

    Um...Nothing output while running "flutter packages global list" from terminal

    Please check below stack info:

    DevTools failed to launch browser Failed to launch browser: ProcessException: No such file or directory
    Command: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome http://127.0.0.1:50026/?hide=debugger&theme=dark&uri=http%3A%2F%2F127.0.0.1%3A50015%2FMovkwQuk-XE%3D
    #0 Chrome._startProcess (package:browser_launcher/src/chrome.dart:128:12)

    #1 Chrome.start (package:browser_launcher/src/chrome.dart:120:11)

    #2 registerLaunchDevToolsService. (package:devtools_server/src/server.dart:238:24)

    #3 VmService._routeRequest (package:vm_service_lib/vm_service_lib.dart:1447:39)

    #4 VmService._processRequest (package:vm_service_lib/vm_service_lib.dart:1425:25)

    #5 VmService._processMessageStr (package:vm_service_lib/vm_service_lib.dart:1393:9)
    #6 VmService._processMessage (package:vm_service_lib/vm_service_lib.dart:1351:7)
    #7 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
    #8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
    #9 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
    #10 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:375:20)
    #11 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:250:5)
    #12 _AsBroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:474:11)
    #13 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
    #14 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
    #15 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
    #16 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
    #17 _StreamController._add (dart:async/stream_controller.dart:640:7)
    #18 _StreamController.add (dart:async/stream_controller.dart:586:5)
    #19 new _WebSocketImpl._fromSocket. (dart:_http/websocket_impl.dart:1138:21)
    #20 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
    #21 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
    #22 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
    #23 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:68:11)
    #24 _EventSinkWrapper.add (dart:async/stream_transformers.dart:15:11)
    #25 _WebSocketProtocolTransformer._messageFrameEnd (dart:_http/websocket_impl.dart:334:22)
    #26 _WebSocketProtocolTransformer.add (dart:_http/websocket_impl.dart:229:46)
    #27 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:120:24)
    #28 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
    #29 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
    #30 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
    #31 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
    #32 _StreamController._add (dart:async/stream_controller.dart:640:7)
    #33 _StreamController.add (dart:async/stream_controller.dart:586:5)
    #34 _Socket._onData (dart:io-patch/socket_patch.dart:1774:41)
    #35 _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
    #36 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
    #37 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
    #38 _SyncStreamController._sendData (dart:async/stream_controller.dart:764:19)
    #39 _StreamController._add (dart:async/stream_controller.dart:640:7)
    #40 _StreamController.add (dart:async/stream_controller.dart:586:5)
    #41 new _RawSocket. (dart:io-patch/socket_patch.dart:1323:33)
    #42 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:844:14)
    #43 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    #44 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
    #45 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:115:13)

  4. aircircle commented on May 29, 2019

    @aircircle
    Author

    um... after install google chrome browser in Mac OS, it works well.
    So the DevTool is only able to run with google chrome browser?

  5. DanTup commented on May 29, 2019

    @DanTup
    Member

    Yes, that's correct. DevTools only works with Chrome (for now, at least). We used to launch the default browser but since DevTools might not work in that it was changed to launch Chrome.

    I'll update the standard popup message to be more descriptive to give a hint that this might be the issue.

  6. DanTup commented on May 29, 2019

    @DanTup
    Member

    Actually, when the error occurs there should be a button that says Show Full Error that already opens this error. Do you not see this?

  7. aircircle commented on May 29, 2019

    @aircircle
    Author

    Yes, I see that.

  8. DanTup commented on May 29, 2019

    @DanTup
    Member

    Ok, then I think there's nothing to do here for now. The button provides a way to get at the real error that came from DevTools, and DevTools only supporting Chrome is known/expected.

    LMK if you think there's something that should be changed and we can revisit :-)

  9. added and removed
    awaiting infoRequires more information from the customer to progress
    on May 29, 2019
  10. changed the title [-]Cannot launch DevTools in visual studio code with iOS[/-] [+]Cannot launch DevTools without having Chrome installed[/+] on May 29, 2019
  11. aircircle commented on May 29, 2019

    @aircircle
    Author

    ok, thanks for the info, issue could be closed

  12. point-source commented on Jun 25, 2019

    @point-source

    Is there a way I can force this to use chromium or some other chromium-based browser rather than chrome?

  13. DanTup commented on Jun 26, 2019

    @DanTup
    Member

    @point-source it may work if you set the CHROME_EXECUTABLE environment variable, but it's not something I've tried.

    Note that the Brave browser - although Chromium-based - fails to work because its anti-fingerprinting feature messes up the canvas rendering (see flutter/devtools#367).

  14. audkar commented on Jul 13, 2019

    @audkar

    Can confirm that overriding env variable for chromium works on Linux.

    export CHROME_EXECUTABLE=chromium
    

    IMHO it would be more user friendly to:

    • start chrome OR chromium by default
    • let override executable in vscode settings
    • catch executable not found exception and print user friendly message
  15. DanTup commented on Jul 13, 2019

    @DanTup
    Member

    In ba85435 the message was changed slightly to "Dart DevTools was unable to launch Chrome."

    Looking for Chromium would need to be done in https://github.com/dart-lang/browser_launcher since that's what DevTools is using to launch the browser (it's not being done by the VS Code extension).

    I don't think there's much value in adding a VS Code setting versus using CHROME_EXECUTABLE, they'd just do the same thing but it would leak knowledge about how DevTools/browser_launcher work into VS Code.

    That said, when running in remote workspaces, we'll now use the default browser (since we can't launch Chrome when running remotely).. I wonder if we should either fall back to that here, or at least add a button to the message for "User default browser instead". DevTools does show a message about unsupported browsers.

  16. reopened this on Jul 13, 2019
  17. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    and removed on Jul 13, 2019
  18. added this to the v3.4.0 milestone on Jul 13, 2019
  19. added
    in commandsRelates to commands (usually invoked from the command Palette)
    on Jul 13, 2019
  20. audkar commented on Jul 13, 2019

    @audkar

    message was changed slightly to "Dart DevTools was unable to launch Chrome."

    For me (non-native english speaker) first conclusion comes in to mind while reading this error: Chrome was starting, but failed in process. Since I have open source Chrome (chromium). That must be a case.

    What actually happens: google-chrome is required but not installed.

    I understand reasoning why it is as is :) Just one of these changes would greatly improve situation:
    a) Catch explicit exception that executable not found. Give message that google-chrome is required. Show solution to override that env variable. For me overriding variable is not hard, but finding info to do so, requires time and effort.
    b) Auto-handle google-chrome/chromium case. That requires modify that 3rd party lib, user other lib, or smth else. That is not blocked by vscode.

    And of-course it's priorities question. Thanks for your work on dart4vscode. It is amazing!

  21. DanTup commented on Jul 15, 2019

    @DanTup
    Member

    What actually happens: google-chrome is required but not installed.

    Unfortunately from the error that occurs (a ProcessException), it's hard to tell that's the case - it could be something else (like it wasn't found in the default location or on PATH, or it just threw an error during launch, etc.). I don't want to code too many assumptions into the VS Code extension about how a dependencies dependency behaves, as it could change.

    I think adding a button to that message that says "Use Default Browser" or similar should help. It lets people use it, but still makes it clear that we wanted to (but failed) launch Chrome.

    That said, I do think it's a valid request for https://github.com/flutter/devtools or https://github.com/dart-lang/browser_launcher to support Chromium, so I think it's worth also opening an issue there (that would mean avoid you seeing the error with the new button, for ex.).

  22. added a commit that references this issue on Aug 6, 2019
    57744e6
  23. DanTup commented on Aug 6, 2019

    @DanTup
    Member

    I've made a change for the next version that will launch the local default browser if DevTools reports an error. It will also show a warning ("Dart DevTools was unable to launch Chrome so your default browser was launched instead.") to indicate that this wasn't the intended behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in commandsRelates to commands (usually invoked from the command Palette)is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions