Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot launch DevTools without having Chrome installed #1760

Closed
aircircle opened this issue May 29, 2019 · 15 comments
Closed

Cannot launch DevTools without having Chrome installed #1760

aircircle opened this issue May 29, 2019 · 15 comments
Labels
in commands Relates to commands (usually invoked from the command Palette) is enhancement
Milestone

Comments

@aircircle
Copy link

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~

@DanTup
Copy link
Member

DanTup commented May 29, 2019

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!

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label May 29, 2019
@aircircle
Copy link
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)

@aircircle
Copy link
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?

@DanTup
Copy link
Member

DanTup commented May 29, 2019

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.

@DanTup
Copy link
Member

DanTup commented May 29, 2019

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?

@aircircle
Copy link
Author

Yes, I see that.

@DanTup
Copy link
Member

DanTup commented May 29, 2019

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 :-)

@DanTup DanTup closed this as completed May 29, 2019
@DanTup DanTup added working as intended Described behaviour is expected. and removed awaiting info Requires more information from the customer to progress labels May 29, 2019
@DanTup DanTup changed the title Cannot launch DevTools in visual studio code with iOS Cannot launch DevTools without having Chrome installed May 29, 2019
@aircircle
Copy link
Author

ok, thanks for the info, issue could be closed

@point-source
Copy link

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

@DanTup
Copy link
Member

DanTup commented Jun 26, 2019

@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).

@audkar
Copy link

audkar commented Jul 13, 2019

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

@DanTup
Copy link
Member

DanTup commented Jul 13, 2019

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.

@DanTup DanTup reopened this Jul 13, 2019
@DanTup DanTup added is enhancement and removed working as intended Described behaviour is expected. labels Jul 13, 2019
@DanTup DanTup added this to the v3.4.0 milestone Jul 13, 2019
@DanTup DanTup added the in commands Relates to commands (usually invoked from the command Palette) label Jul 13, 2019
@audkar
Copy link

audkar commented Jul 13, 2019

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!

@DanTup
Copy link
Member

DanTup commented Jul 15, 2019

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.).

@DanTup
Copy link
Member

DanTup commented Aug 6, 2019

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
Labels
in commands Relates to commands (usually invoked from the command Palette) is enhancement
Projects
None yet
Development

No branches or pull requests

4 participants