Dart-code: Can't start DevTools from VS Code: Dart DevTools exited with code 66

Created on 27 Apr 2020  Â·  14Comments  Â·  Source: Dart-Code/Dart-Code

Hi there,

I get "code 66" error when trying to start DevTools from VS Code. Here's my log:

Dart Code extension: 3.9.1
Flutter extension: 3.9.1 (not activated)
VS Code: 1.44.2
Platform: linux
Workspace type: Flutter
Multi-root?: false
Dart SDK:
    Loc: /home/machine/tools/flutter/bin/cache/dart-sdk
    Ver: 2.7.2
Flutter SDK:
    Loc: /home/machine/tools/flutter
    Ver: 1.12.13+hotfix.9
HTTP_PROXY: undefined
NO_PROXY: undefined

Mon Apr 27 2020 [13:26:30 ...] Log file started
[13:26:36] [CommandProcesses] [Info] (PROC 11029) Logging data for process...
[13:26:37] [CommandProcesses] [Info] (PROC 11029) devtools 0.2.3
[13:26:37] [CommandProcesses] [Info] (PROC 11029) exited (0, null)
[13:26:37] [CommandProcesses] [Info] (PROC 11029) closed (0, null)
[13:26:37] [DevTools] [Info] Spawning /home/machine/tools/flutter/bin/cache/dart-sdk/bin/pub with args ["global","run","devtools","--machine","--enable-notifications","--try-ports","10"]
[13:26:37] [DevTools] [Info] ..  with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[13:26:37] [DevTools] [Info]     PID: 6638
[13:26:37] [DevTools] [Error] Could not find a file named "pubspec.yaml" in "/home/machine/.pub-cache/hosted/pub.dartlang.org/devtools-0.2.3".
[13:26:37] [DevTools] [Info] Process terminated! 66, null
[13:26:37] [General] [Error] Dart DevTools exited with code 66
[13:26:37] [General] [Error] Dart DevTools exited with code 66
Mon Apr 27 2020 [13:26:41 ...] Log file ended

I followed the steps in #2128 and deactivated then reactivated devtools. What I noticed though was that it's looking for the pubspec.yaml file in ~/.pub-cache/hosted/pub.dartlang.org/devtools-0.2.3 but the directory ~/.pub-cache/hosted does not exist.

I did have issues with my flutter environment a while back, and may have removed ~/.pub-cache/hosted to fix my dependencies, but I can't remember for sure. It was a long day and my caffeine levels were dangerously low!

Any idea on how I could fix this? Thanks!

duplicate

Most helpful comment

i have same problem. Commands from terminal did not work.

=>flutter pub global list
devtools 0.2.4

=>flutter pub global deactivate devtools
Deactivated package devtools 0.2.4.

=>flutter pub global activate devtools
Downloading.......
Precompiling executables...
Precompiled devtools:devtools.
Installed executable devtools.
Activated devtools 0.2.4.

=>flutter pub global run devtools

Unhandled exception:
Invalid argument(s): A directory corresponding to fileSystemPath "...Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/devtools-0.2.4/build" could not be found

#0      createStaticHandler (package:shelf_static/src/static_handler.dart:50:5)
#1      defaultHandler (package:devtools_server/src/external_handlers.dart:41:23)
<asynchronous suspension>
#2      serveDevTools (package:devtools_server/src/server.dart:211:21)
#3      serveDevToolsWithArgs (package:devtools_server/src/server.dart:149:10)
#4      main (file:///Users/zaferyasinalemdaroglu/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/devtools-0.2.4/bin/devtools.dart:9:3)
#5      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
#6      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
pub finished with exit code 255

All 14 comments

@lukevenediger can you post the full output of running these commands (individually)?

~/tools/flutter/bin/cache/dart-sdk/bin/pub global list

~/tools/flutter/bin/cache/dart-sdk/bin/pub global deactivate devtools

~/tools/flutter/bin/cache/dart-sdk/bin/pub global activate devtools

~/tools/flutter/bin/cache/dart-sdk/bin/pub global run devtools

hi @DanTup - I have the same error and tried your commands. Here is the result:

anthony@Anthonys-MacBook-Air ~ % flutter pub global list
devtools 0.2.3
anthony@Anthonys-MacBook-Air ~ % flutter pub global deactivate devtools
Deactivated package devtools 0.2.3.
anthony@Anthonys-MacBook-Air ~ % flutter pub global activate devtools
Resolving dependencies...

  • args 1.6.0
  • async 2.4.1
  • browser_launcher 0.1.5
  • charcode 1.1.3
  • collection 1.14.12
  • convert 2.1.1
  • crypto 2.1.4
  • devtools 0.2.3 (0.2.4-dev.1 available)
  • devtools_server 0.2.3 (0.2.4-dev.1 available)
  • devtools_shared 0.2.3 (0.2.4-dev.1 available)
  • http 0.12.1
  • http_multi_server 2.2.0
  • http_parser 3.1.4
  • intl 0.16.1
  • logging 0.11.4
  • meta 1.1.8
  • mime 0.9.6+3
  • path 1.7.0
  • pedantic 1.9.0
  • shelf 0.7.5
    anthony@Anthonys-MacBook-Air ~ % flutter pub global list
    devtools 0.2.3
    anthony@Anthonys-MacBook-Air ~ % flutter pub global deactivate devtools
    Deactivated package devtools 0.2.3.
    anthony@Anthonys-MacBook-Air ~ % flutter pub global activate devtools
    Resolving dependencies...
  • args 1.6.0
  • async 2.4.1
  • browser_launcher 0.1.5
  • charcode 1.1.3
  • collection 1.14.12
  • convert 2.1.1
  • crypto 2.1.4
  • devtools 0.2.3 (0.2.4-dev.1 available)
  • devtools_server 0.2.3 (0.2.4-dev.1 available)
  • devtools_shared 0.2.3 (0.2.4-dev.1 available)
  • http 0.12.1
  • http_multi_server 2.2.0
  • http_parser 3.1.4
  • intl 0.16.1
  • logging 0.11.4
  • meta 1.1.8
  • mime 0.9.6+3
  • path 1.7.0
  • pedantic 1.9.0
  • shelf 0.7.5
  • shelf_static 0.2.8
  • source_span 1.7.0
  • sse 3.5.0
  • stack_trace 1.9.3
  • stream_channel 2.0.0
  • string_scanner 1.0.5
  • term_glyph 1.1.0
  • typed_data 1.1.6
  • usage 3.4.1
  • uuid 2.0.4
  • vm_service 3.0.0+1 (4.0.2 available)
  • webkit_inspection_protocol 0.5.0+1
    Precompiling executables...
    Precompiled devtools:devtools.
    Installed executable devtools.
    Activated devtools 0.2.3.
    anthony@Anthonys-MacBook-Air ~ % flutter pub global run devtools
    Serving DevTools at http://127.0.0.1:9100

Hey @DanTup, I'm sorry about not getting back to you sooner. My desktop crashed and I haven't been able to resuscitate it yet. Thanks @santhonydo for posting that output!

I should have it running in the next few days and I'll come back here and post the output that you asked for.

@santhonydo after running those, does DevTools now work from VS Code? If not, can you provide a new log file to see if it's different? The original error shows DevTools failing to activate, but in the output from running the commands, it seems to be starting up normally.

Thanks!

@DanTup still getting error code 66 from VS code. here's the new log:

Dart Code extension: 3.9.1
Flutter extension: 3.9.1 (not activated)
VS Code: 1.44.2
Platform: mac
Workspace type: Flutter
Multi-root?: false
Dart SDK:
Loc: /Users/anthony/Documents/dev/flutter/bin/cache/dart-sdk
Ver: 2.8.0
Flutter SDK:
Loc: /Users/anthony/Documents/dev/flutter
Ver: 1.17.0-3.3.pre
HTTP_PROXY: undefined
NO_PROXY: undefined

Sun May 03 2020 [16:05:07 GMT-0700 (Pacific Daylight Time)] Log file started
[4:06:33 PM] [CommandProcesses] [Info] (PROC 2177) Logging data for process...
[4:06:34 PM] [CommandProcesses] [Info] (PROC 2177) devtools 0.2.3
[4:06:34 PM] [CommandProcesses] [Info] (PROC 2177) exited (0, null)
[4:06:34 PM] [CommandProcesses] [Info] (PROC 2177) closed (0, null)
[4:06:34 PM] [DevTools] [Info] Spawning /Users/anthony/Documents/dev/flutter/bin/cache/dart-sdk/bin/pub with args ["global","run","devtools","--machine","--enable-notifications","--try-ports","10"]
[4:06:34 PM] [DevTools] [Info] .. with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[4:06:34 PM] [DevTools] [Info] PID: 584
[4:06:34 PM] [DevTools] [Error] Could not find a file named "pubspec.yaml" in "/Users/anthony/.pub-cache/hosted/pub.dartlang.org/devtools-0.2.3".
[4:06:34 PM] [DevTools] [Info] Process terminated! 66, null
[4:06:34 PM] [General] [Error] Dart DevTools exited with code 66
[4:06:34 PM] [General] [Error] Dart DevTools exited with code 66
Sun May 03 2020 [16:06:42 GMT-0700 (Pacific Daylight Time)] Log file ended

@santhonydo looks like the commands you ran were different to the ones I posted:

~/tools/flutter/bin/cache/dart-sdk/bin/pub global activate devtools

vs

anthony@Anthonys-MacBook-Air ~ % flutter pub global activate devtools

VS Code always uses pub for DevTools and not flutter. Please try re-running them as above, and let me know if that solves the issue or you have any errors.

@DanTup thanks! the issue was resolved after running these commands again

`~/tools/flutter/bin/cache/dart-sdk/bin/pub global list

~/tools/flutter/bin/cache/dart-sdk/bin/pub global deactivate devtools

~/tools/flutter/bin/cache/dart-sdk/bin/pub global activate devtools

~/tools/flutter/bin/cache/dart-sdk/bin/pub global run devtools`

@santhonydo great! My guess is that something happened to your pub cache (I see this a lot, as I often delete it when I hit weird issues), and reinstalling would've fixed it (~/tools/flutter/bin/cache/dart-sdk/bin/pub cache repair probably would've also worked, but could also be a lot slower if you have a lot of packages in there).

@lukevenediger please let me know if you're still seeing this and the steps above don't help.

i have same problem. Commands from terminal did not work.

=>flutter pub global list
devtools 0.2.4

=>flutter pub global deactivate devtools
Deactivated package devtools 0.2.4.

=>flutter pub global activate devtools
Downloading.......
Precompiling executables...
Precompiled devtools:devtools.
Installed executable devtools.
Activated devtools 0.2.4.

=>flutter pub global run devtools

Unhandled exception:
Invalid argument(s): A directory corresponding to fileSystemPath "...Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/devtools-0.2.4/build" could not be found

#0      createStaticHandler (package:shelf_static/src/static_handler.dart:50:5)
#1      defaultHandler (package:devtools_server/src/external_handlers.dart:41:23)
<asynchronous suspension>
#2      serveDevTools (package:devtools_server/src/server.dart:211:21)
#3      serveDevToolsWithArgs (package:devtools_server/src/server.dart:149:10)
#4      main (file:///Users/zaferyasinalemdaroglu/Desktop/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/devtools-0.2.4/bin/devtools.dart:9:3)
#5      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
#6      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
pub finished with exit code 255

I'm getting the same issue as well.

~  flutter pub global list
devtools 0.2.4
~  flutter pub global deactivate devtools
Deactivated package devtools 0.2.4.
~  flutter pub global activate devtools
Resolving dependencies...
+ args 1.6.0
+ async 2.4.1
+ browser_launcher 0.1.5
+ charcode 1.1.3
+ collection 1.14.12
+ convert 2.1.1
+ crypto 2.1.4
+ devtools 0.2.4
+ devtools_server 0.2.4
+ devtools_shared 0.2.4
+ http 0.12.1
+ http_multi_server 2.2.0
+ http_parser 3.1.4
+ intl 0.16.1
+ logging 0.11.4
+ meta 1.1.8
+ mime 0.9.6+3
+ path 1.7.0
+ pedantic 1.9.0
+ shelf 0.7.5
+ shelf_proxy 0.1.0+7
+ shelf_static 0.2.8
+ source_span 1.7.0
+ sse 3.5.0
+ stack_trace 1.9.3
+ stream_channel 2.0.0
+ string_scanner 1.0.5
+ term_glyph 1.1.0
+ typed_data 1.1.6
+ usage 3.4.1
+ uuid 2.0.4
+ vm_service 4.0.2
+ webkit_inspection_protocol 0.5.2
Precompiling executables...
Precompiled devtools:devtools.
Installed executable devtools.
Activated devtools 0.2.4.
~  flutter pub global run devtools
Unhandled exception:
Invalid argument(s): A directory corresponding to fileSystemPath "/Users/gui.lazzaris/.pub-cache/hosted/pub.dartlang.org/devtools-0.2.4/build" could not be found
#0      createStaticHandler (package:shelf_static/src/static_handler.dart:50:5)
#1      defaultHandler (package:devtools_server/src/external_handlers.dart:41:23)
<asynchronous suspension>
#2      serveDevTools (package:devtools_server/src/server.dart:211:21)
#3      serveDevToolsWithArgs (package:devtools_server/src/server.dart:149:10)
#4      main (file:///Users/gui.lazzaris/.pub-cache/hosted/pub.dartlang.org/devtools-0.2.4/bin/devtools.dart:9:3)
#5      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
#6      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
pub finished with exit code 255

I now have the same problem with the same error message: A directory corresponding to fileSystemPath ".../.pub-cache/hosted/pub.dartlang.org/devtools-0.2.4/build" could not be found.

I use Flutter. So I'll follow https://github.com/flutter/devtools/issues/1915.

@guilazzaris Looks like you're running flutter pub instead of just pub. See https://github.com/Dart-Code/Dart-Code/issues/2398#issuecomment-623375792.

@suztomo

I use Flutter. So I'll follow flutter/devtools#1915.

VS Code always uses DevTools through pub and not flutter pub. The error is because your non-Flutter install of DevTools is damaged. Please follow the instructions above and it will likely resolve your issue.

For #2430 I've implemented a prompt so if this happens, you can just click and it'll reactivate DevTools:

Screenshot 2020-05-06 at 16 03 36

I'm not sure why so many people have hit this - is it possible you've cleared out your pub-cache folders?

Until the next release, the quick fix is to run pub global activate devtools (note: no flutter at the start).

I had this issue. [SOLVED] as follow:

dart pub cache repair
dart pub cache add devtools
dart pub cache repair
dart pub global activate devtools
dart pub global run devtools (to check it's working)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mccadi picture mccadi  Â·  3Comments

Matt-Gleich picture Matt-Gleich  Â·  4Comments

rgb1380 picture rgb1380  Â·  3Comments

atreeon picture atreeon  Â·  5Comments

DanTup picture DanTup  Â·  4Comments