Skip to content
Latchkey

Dart "command not found" in CI

The shell could not run dart, or dart did not recognize a subcommand. The SDK is missing from PATH, or the command name is wrong for this SDK version.

What this error means

CI fails with dart: command not found, or Could not find a command named "X". It is deterministic and tied to the environment.

dart
/bin/sh: dart: command not found
# or
Could not find a command named "packages".
Did you mean "pub"?

Common causes

Dart SDK not installed or not on PATH

The runner has no Dart SDK, or its bin directory is not exported to PATH.

Outdated subcommand

Old commands like pub get (standalone) or flutter packages get changed; current Dart uses dart pub get.

How to fix it

Install Dart and add it to PATH

Set up the SDK so dart is runnable.

CI step
export PATH="$PATH:/usr/lib/dart/bin"
dart --version

Use current subcommands

  1. Replace pub get with dart pub get.
  2. Use dart run instead of the old pub run.
  3. Check dart --help for the current command names.

How to prevent it

  • Use a setup step that installs Dart and exports PATH.
  • Pin the Dart/Flutter SDK version in CI.
  • Keep commands aligned with the SDK version.

Frequently asked questions

What causes ""dart: command not found""?
The runner has no Dart SDK, or its bin directory is not exported to PATH.
How do I fix "dart: command not found"?
Set up the SDK so dart is runnable.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card