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.
/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.
export PATH="$PATH:/usr/lib/dart/bin"
dart --versionUse current subcommands
- Replace
pub getwithdart pub get. - Use
dart runinstead of the oldpub run. - Check
dart --helpfor 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.