Dart pub "version solving failed" in CI
The pub solver could not find a set of package versions satisfying every constraint. Two packages disagree on a shared dependency, or the SDK bound excludes valid versions.
What this error means
pub get fails with version solving failed, explaining which constraints conflict. It is deterministic given pubspec.yaml and the SDK version.
dart
Because app depends on http ^1.2.0 and foo depends on http ^0.13.0,
version solving failed.
The current Dart SDK version is 3.4.0.Common causes
Conflicting package constraints
Two dependencies require incompatible ranges of a shared package, so no version satisfies both.
SDK constraint mismatch
A package requires a Dart/Flutter SDK newer or older than the one on the runner.
How to fix it
Resolve the conflicting constraint
- Read which two packages disagree on which shared dependency.
- Upgrade the lagging package or relax your own bound.
- Run
dart pub getagain to confirm.
Match the SDK version
Set an SDK constraint that fits the runner, or use the SDK the packages require.
pubspec.yaml
environment:
sdk: ">=3.3.0 <4.0.0"Inspect why a constraint is forced
See which dependency pins the troublesome range.
CI step
dart pub deps
dart pub get --verbosity=allHow to prevent it
- Keep dependency ranges compatible.
- Pin the SDK version in CI to match pubspec.
- Commit a pubspec.lock for reproducibility.
Related guides
Dart "Not found: dart:X" / package URI errorFix Dart "Error: Not found: dart:html" / "Not found: package:..." in CI - wrong platform library or an unreso…
Dart "command not found" in CIFix "dart: command not found" / unknown pub subcommand in CI - the Dart SDK is not installed or not on PATH,…
SwiftPM "could not resolve package dependencies" in CIFix SwiftPM "failed to resolve dependencies" / version conflicts in CI when packages cannot be checked out or…