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

Flutter entry scripts in lib/web are incorrectly considered Dart-web #2690

Closed
sma opened this issue Aug 1, 2020 · 5 comments · Fixed by #2730
Closed

Flutter entry scripts in lib/web are incorrectly considered Dart-web #2690

sma opened this issue Aug 1, 2020 · 5 comments · Fixed by #2730
Labels
in debugger Relates to the debug adapter or process of launching a debug session is bug
Milestone

Comments

@sma
Copy link

sma commented Aug 1, 2020

I get this error after the Dart-code (or Flutter-code) plugin wanted to update the webdev package:

Unhandled exception:
ProcessException: ***OUT***

***ERR***
The Flutter SDK is not available.

***
  Command: /Users/sma/Work/flutter/bin/cache/dart-sdk/bin/pub deps
�[38;5;248m#0      _runPubDeps  (package:webdev/src/pubspec.dart:70:5)�[39;49m
�[38;5;248m#1      PubspecLock.read  (package:webdev/src/pubspec.dart:84:11)�[39;49m
�[38;5;248m#2      readPubspecLock  (package:webdev/src/command/shared.dart:63:39)�[39;49m
�[38;5;248m#3      DaemonCommand.run  (package:webdev/src/command/daemon_command.dart:68:29)�[39;49m
�[38;5;248m#4      CommandRunner.runCommand�[39;49m
�[38;5;248m#5      _CommandRunner.runCommand  (package:webdev/src/webdev_command_runner.dart:38:24)�[39;49m
�[38;5;248m#6      CommandRunner.run.<anonymous closure>�[39;49m
�[38;5;244m#7      new Future.sync  (dart:async/future.dart:223:31)�[39;49m
�[38;5;248m#8      CommandRunner.run�[39;49m
�[38;5;248m#9      run  (package:webdev/src/webdev_command_runner.dart:19:56)�[39;49m
�[38;5;248m#10     main�[39;49m
�[38;5;244m#11     _startIsolate.<anonymous closure>  (dart:isolate-patch/isolate_patch.dart:299:32)�[39;49m
�[38;5;244m#12     _RawReceivePortImpl._handleMessage  (dart:isolate-patch/isolate_patch.dart:168:12)�[39;49m

Exited (255)

I'm using Visual Studio Code 1.47.3 with Dart/Flutter code 3.13.0 on macOS 10.15.6

I'm using:

$ flutter --version
Flutter 1.21.0-6.0.pre.141 • channel master • https://github.com/flutter/flutter.git
Framework • revision c748f1a7aa (8 hours ago) • 2020-07-31 17:45:18 -0700
Engine • revision 280bbfc763
Tools • Dart 2.10.0 (build 2.10.0-2.0.dev bd528bfbd6)

Because that version of Flutter includes a full version of Dart, I have no separate Dart SDK installed.

For some reason, the webdev package wants to run the pub command from the cached Dart SDK which fails. Upon further inspection, this could be a problem with that package but it occurs because this plugin wanted to install webdev and I'm now stuck.

@DanTup
Copy link
Member

DanTup commented Aug 1, 2020

Can you capture a log when reproducing this and attach it here?

  • Run the Dart: Capture Logs command from the VS Code command palette
  • Untick Analysis Server but leave everything else ticked
  • Reproduce the issue
  • Attach the log

Thanks!

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Aug 1, 2020
@sma
Copy link
Author

sma commented Aug 1, 2020

Here you go.

BTW, I'm clicking on "Run" label inside the source file. My project is configured for iOS, Android, web, and macOS.

Dart Code extension: 3.13.0
Flutter extension: 3.13.0 (activated)

App: Visual Studio Code
Version: 1.47.3
Platform: mac

Workspace type: Flutter
Analyzer type: DAS
Multi-root?: false

Dart SDK:
    Loc: /Users/sma/Work/flutter/bin/cache/dart-sdk
    Ver: 2.10.0-edge.bd528bfbd69deecd3e8ad21e634da495bf0c09bb
Flutter SDK:
    Loc: /Users/sma/Work/flutter
    Ver: 1.21.0-6.0.pre.141

HTTP_PROXY: undefined
NO_PROXY: undefined

Sat Aug 01 2020 [15:11:29 GMT+0200 (Mitteleuropäische Sommerzeit)] Log file started
[15:11:37] [General] [Info] Starting debug session...
[15:11:37] [General] [Info]     workspace: /Users/sma/Work/hermes_flutter
[15:11:37] [General] [Info]     program  : /Users/sma/Work/hermes_flutter/lib/web/minimarkdown.dart
[15:11:37] [General] [Info] Using workspace as cwd: /Users/sma/Work/hermes_flutter
[15:11:37] [General] [Info] Detected launch project as Web
[15:11:37] [General] [Info] Using Web debug adapter for this session
[15:11:37] [General] [Info] Spawning /Users/sma/Work/flutter/bin/cache/dart-sdk/bin/pub with args ["global","list"]
[15:11:37] [CommandProcesses] [Info] (PROC 95532) Logging data for process...
[15:11:37] [CommandProcesses] [Info] (PROC 95532) devtools 0.8.0+2
[15:11:37] [CommandProcesses] [Info] (PROC 95532) stagehand 3.2.0
webdev 2.5.9
[15:11:37] [CommandProcesses] [Info] (PROC 95532) exited (0, null)
[15:11:37] [CommandProcesses] [Info] (PROC 95532) closed (0, null)
[15:11:37] [General] [Info] Checking for errors before launching
[15:11:37] [General] [Info] Debug session starting...
    {
        "name": "Dart ",
        "noDebug": true,
        "request": "launch",
        "type": "dart",
        "program": "/Users/sma/Work/hermes_flutter/lib/web/minimarkdown.dart",
        "cwd": "/Users/sma/Work/hermes_flutter",
        "dartVersion": "2.10.0-edge.bd528bfbd69deecd3e8ad21e634da495bf0c09bb",
        "toolEnv": {
            "FLUTTER_HOST": "VSCode",
            "PUB_ENVIRONMENT": "vscode.dart-code"
        },
        "sendLogsToClient": true,
        "args": [],
        "vmAdditionalArgs": [],
        "vmServicePort": 0,
        "dartPath": "/Users/sma/Work/flutter/bin/cache/dart-sdk/bin/dart",
        "maxLogLineLength": 2000,
        "pubPath": "/Users/sma/Work/flutter/bin/cache/dart-sdk/bin/pub",
        "pubSnapshotPath": "/Users/sma/Work/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot",
        "debugSdkLibraries": false,
        "debugExternalLibraries": false,
        "showDartDeveloperLogs": true,
        "evaluateGettersInDebugViews": true,
        "evaluateToStringInDebugViews": true,
        "globalFlutterArgs": [],
        "useFlutterStructuredErrors": true,
        "debugExtensionBackendProtocol": "ws",
        "flutterVersion": "1.21.0-6.0.pre.141",
        "forceFlutterVerboseMode": true,
        "flutterTrackWidgetCreation": true,
        "flutterMode": "debug",
        "flutterPlatform": "default",
        "flutterPath": "/Users/sma/Work/flutter/bin/flutter",
        "workspaceConfig": {
            "useLsp": false
        },
        "deviceId": "790A053F-57D8-4BFA-AF54-E0F3EC2EA1EB",
        "deviceName": "iPhone SE (2nd generation) (ios)",
        "showMemoryUsage": false,
        "debugServer": 55158,
        "debuggerType": 4
    }
[15:11:37] [General] [Warn] Did not find session e8a1b5c6-832a-41dd-a016-b920f34e04d7 to handle dart.progressStart. There were 0 sessions:
[15:11:37] [General] [Warn] Event will be queued and processed when the session start event fires
[15:11:37] [General] [Info] Processing delayed event dart.progressStart for session e8a1b5c6-832a-41dd-a016-b920f34e04d7
[15:11:37] [WebDaemon] [Info] [Dart ] Spawning /Users/sma/Work/flutter/bin/cache/dart-sdk/bin/pub with args ["global","run","webdev","daemon"]
[15:11:37] [WebDaemon] [Info] [Dart ] ..  in /Users/sma/Work/hermes_flutter
[15:11:37] [WebDaemon] [Info] [Dart ] ..  with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[15:11:37] [WebDaemon] [Info] [Dart ]     PID: 95110
[15:11:38] [WebDaemon] [Error] [Dart ] Unhandled exception:
[15:11:38] [WebDaemon] [Error] [Dart ] 
ProcessException: ***OUT***

***ERR***
The Flutter SDK is not available.

***
  Command: /Users/sma/Work/flutter/bin/cache/dart-sdk/bin/pub deps
#0      _runPubDeps (package:webdev/src/pubspec.dart:70:5)
#1      PubspecLock.read (package:webdev/src/pubspec.dart:84:11)
#2      readPubspecLock (package:webdev/src/command/shared.dart:63:39)
#3      DaemonCommand.run (package:webdev/src/command/daemon_command.dart:68:29)
#4      CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#5      _CommandRunner.runCommand (package:webdev/src/webdev_command_runner.dart:38:24)
#6      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#7      new Future.sync (dart:async/future.dart:223:31)
#8      CommandRunner.run (package:args/command_runner.dart:112:14)
#9      run (package:webdev/src/webdev_command_runner.dart:19:56)
#10     main (file:///Users/sma/.pub-cache/hosted/pub.dartlang.org/webdev-2.5.9/bin/webdev.dart:17:22)
#11     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#12     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
[15:11:38] [WebDaemon] [Info] [Dart ] Process terminated! 255, null
[15:11:38] [VmService] [Info] [Dart ] Process exited (255)
[15:11:38] [VmService] [Info] [Dart ] Disconnect requested!
[15:11:38] [VmService] [Info] [Dart ] TERM: Requested to terminate with SIGINT...
[15:11:38] [VmService] [Info] [Dart ] TERM: Did not need to terminate processes
[15:11:38] [VmService] [Info] [Dart ] TERM: Removing all stored data...
[15:11:38] [VmService] [Info] [Dart ] TERM: Waiting for process to finish...
[15:11:38] [VmService] [Info] [Dart ] TERM: Disconnecting...
[15:11:38] [General] [Info] Debugger:SessionDuration timing: 844ms (Web)
Sat Aug 01 2020 [15:11:40 GMT+0200 (Mitteleuropäische Sommerzeit)] Log file ended

@DanTup
Copy link
Member

DanTup commented Aug 3, 2020

@sma It looks like you're trying to fun a Flutter project using the Dart-web mechanism (using a "web/" path as the "program" in launch.json).

Can you clarify what type of project you're trying to run? For a Flutter app, your code generally lives inside the lib folder, not the web folder. Using "web" in "program" will force the Dart-web debugger that won't work with Fluter projects.

@sma
Copy link
Author

sma commented Aug 4, 2020

I don't think so. Is there a "magical" detecting going on that prevents me from using .../lib/web/minimarkdown.dart as a file name? I simply picked the folder name web for that subfolder because it contains dart code specific for the web version of my app. I would have expected that any name would work. Is there a similar problem if I'd have picked test?

I renamed the path to .../lib/bew/minimarkdown.dart (just to pick a different folder name) and now it works!

@DanTup
Copy link
Member

DanTup commented Aug 4, 2020

Is there a "magical" detecting going on that prevents me from using .../lib/web/minimarkdown.dart as a file name?

Oh, sorry - I didn't notice this was inside lib. I guess our detection of Dart web apps is a bit aggressive and should only consider web from the project root. I'll take a look, thanks!

@DanTup DanTup added this to the v3.14.0 milestone Aug 4, 2020
@DanTup DanTup added in debugger Relates to the debug adapter or process of launching a debug session is bug and removed awaiting info Requires more information from the customer to progress labels Aug 4, 2020
@DanTup DanTup changed the title After plugin wanted to update/install webdev package, launching apps fails. Flutter entry scripts in lib/web are incorrectly considered Dart-web Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in debugger Relates to the debug adapter or process of launching a debug session is bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants