Skip to content

fix: jaspr_cli fails to verify Dart SDK when Flutter is installed via Ubuntu Snap (/snap/bin/dart) #974

Open

Description

@mark-dropbear

Description

On Ubuntu/Linux, when Flutter is installed via the official Snap package (sudo snap install flutter --classic), which dart resolves to /snap/bin/dart. Running jaspr create (or jaspr doctor) fails with an exception
because jaspr_cli expects the dart executable path from which dart to be located directly inside the Dart or Flutter SDK directory rather than a Snap wrapper binary.

Steps To Reproduce

  1. On Ubuntu Linux, install Flutter via Snap (sudo snap install flutter --classic), which places /snap/bin/flutter and /snap/bin/dart on PATH.
  2. Activate jaspr_cli (dart pub global activate jaspr_cli).
  3. Run jaspr create --mode server --routing multi-page --flutter none --backend shelf . (or jaspr doctor).
  4. See error:
Error: Exception: Found Dart executable at "/snap/bin/dart", but failed to verify the surrounding Dart SDK.
Make sure "which dart" resolves to the Dart executable inside the Dart or Flutter SDK directory.
Stack trace: #0      dartExecutable.<anonymous closure> (package:jaspr_cli/src/project.dart:336)
#1      dartExecutable (package:jaspr_cli/src/project.dart:340)
#2      CreateCommand.runCommand (package:jaspr_cli/src/commands/create_command.dart)
<asynchronous suspension>
#3      BaseCommand.run (package:jaspr_cli/src/commands/base_command.dart:55)
<asynchronous suspension>
#4      CommandRunner.runCommand (package:args/command_runner.dart:212)
<asynchronous suspension>
#5      JasprCommandRunner.runCommand (package:jaspr_cli/src/command_runner.dart:108)
<asynchronous suspension>
#6      JasprCommandRunner.run (package:jaspr_cli/src/command_runner.dart:62)
<asynchronous suspension>
#7      main (file:///home/mark/.pub-cache/hosted/pub.dev/jaspr_cli-0.23.5/bin/jaspr.dart:7)
<asynchronous suspension>

Doctor Output

With default Snap PATH (which dart -> /snap/bin/dart), jaspr doctor also crashes with the same error:

Error: Exception: Found Dart executable at "/snap/bin/dart", but failed to verify the surrounding Dart SDK.
Make sure "which dart" resolves to the Dart executable inside the Dart or Flutter SDK directory.
Stack trace: #0      dartExecutable.<anonymous closure> (package:jaspr_cli/src/project.dart:336)
#1      dartExecutable (package:jaspr_cli/src/project.dart:340)
#2      dartSdkVersion.<anonymous closure> (package:jaspr_cli/src/project.dart)
#3      dartSdkVersion (package:jaspr_cli/src/project.dart:355)
#4      DoctorCommand.runCommand (package:jaspr_cli/src/commands/doctor_command.dart)

After manually prepending $HOME/snap/flutter/common/flutter/bin/cache/dart-sdk/bin ahead of /snap/bin in PATH:

[✓] Jaspr CLI (Version 0.23.5)
  • Dart Version 3.13.5 (stable) (Tue Sep 29 01:00:52 2026 -0700) on "linux_x64" at /home/mark/snap/flutter/common/flutter/bin/cache/dart-sdk/bin//dart
  • Running on linux Linux 7.0.0-42-generic #42-Ubuntu SMP PREEMPT_DYNAMIC Thu Oct 15 08:06:44 UTC 2026 - Locale en_AU.UTF-8
  • Analytics: Enabled
[✓] Current Project
  • Dependencies on core packages:
    • jaspr: ^0.23.5
    • jaspr_builder: ^0.23.5 (dev)
    • jaspr_router: ^0.9.0
  • Rendering mode: server
  • Flutter mode: none

Expected Behavior

jaspr_cli should detect the underlying Dart SDK when Flutter/Dart is installed via Ubuntu Snap without requiring users to manually override /snap/bin in their PATH.

Additional Context

In packages/jaspr_cli/lib/src/project.dart (lines 301–340), dartExecutable runs which dart and checks isSdkExecutable(executable) by looking for a version file relative to executable (../version or
./cache/dart-sdk/version).

Because /snap/bin/dart is a Snap wrapper (lrwxrwxrwx /snap/bin/dart -> flutter.dart) and the actual SDK is located at $HOME/snap/flutter/common/flutter/bin/cache/dart-sdk, the check fails.

Possible fixes in dartExecutable:

  • Fall back to checking Platform.resolvedExecutable if isSdkExecutable(Platform.resolvedExecutable) is true, or
  • On Linux when executable == '/snap/bin/dart', check $HOME/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart.

Activity

  1. added
    bug
    on Nov 4, 2026
  2. schultek commented on Nov 4, 2026

    @schultek
    Owner

    Can you try the same thing with jaspr 0.24.0-beta.0, because the way the dart sdk is detected changed in this version. Thanks.

  3. schultek commented on Nov 11, 2026

    @schultek
    Owner

    To fix the sdk resolution, you can also set a global env var DART_SDK as written here: https://pub.dev/documentation/cli_util/latest/cli_util/sdkPath.html

    But I'd recommend opening an issue on cli_util directly.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions