Can't resolve Dart App Engine dependency

Issue

I am trying to build a Dart application for Google App Engine but Dart can’t resolve any appengine dependency except for the 0.0.1 version. Here is my pubspec.yaml:

name: MyApp
version: 0.0.1
dependencies:
  angular2: 2.0.0-alpha.44
  browser: ^0.10.0
  appengine: '>=0.3.0 < 0.4.0'
transformers:
- angular2:
    entry_points: web/main.dart

This is the error I get:

Package appengine has no versions that match >=0.3.0 <0.4.0 derived from:
- MyApp depends on version >=0.3.0 <0.4.0

I have tried every appengine version from https://pub.dartlang.org/packages/appengine/versions but the only one that works is ^0.0.1

Downloading appengine 0.0.1...
Got dependencies!

I would really like to use something newer than 0.0.1. Is something broken or am I missing something?

*Update:
I ran in verbose mode as per Günter Zöchbauer’s suggestion and this is the output:

ERR : Package appengine has no versions that match >=0.0.2 <0.4.0 derived from:
    | - MyApp depends on version >=0.0.2 <0.4.0
FINE: Exception type: NoVersionException
FINE: package:pub/src/entrypoint.dart 154      Entrypoint.acquireDependencies.<async>
    | ===== asynchronous gap ===========================
    | dart:async                               _Completer.completeError
    | package:pub/src/entrypoint.dart 199      Entrypoint.acquireDependencies.<async>
    | ===== asynchronous gap ===========================
    | dart:async                               _Future.then
    | package:pub/src/entrypoint.dart 152      Entrypoint.acquireDependencies.<async>
    | ===== asynchronous gap ===========================
    | dart:async                               Future.Future.microtask
    | package:pub/src/entrypoint.dart          Entrypoint.acquireDependencies
    | package:pub/src/command/get.dart 30      GetCommand.run
    | package:args/command_runner.dart 178     CommandRunner.runCommand.<fn>
    | dart:async                               Future.Future.sync
    | package:args/command_runner.dart 131     CommandRunner.runCommand
    | package:pub/src/command_runner.dart 130  PubCommandRunner.runCommand.<async>.<fn>
    | dart:async                               Future.Future.sync
    | package:pub/src/utils.dart 103           captureErrors.<fn>
    | package:stack_trace                      Chain.capture
    | package:pub/src/utils.dart 117           captureErrors
    | package:pub/src/command_runner.dart 130  PubCommandRunner.runCommand.<async>

I expanded the version to include anything between 0.0.2 and 0.4.0 and it fails. It is definitely throwing a no version found error even though I can manually download the versions from the web.

Solution

This is a known issue with pub. If it can’t resolve a matching set of dependencies it sometimes prints misleading messages.

pub upgrade --verbose 

should reveal more information that allows to investigate what dependencies pub is unable to find compatible versions of.

The conflict is the protobuf package.
appengine 0.3.2 depends on protobuf 0.5.0
angular2 2.0.0-alpha.44 depends on protobuf 0.4.2
but angular2 2.0.0-alpha.45 also depends on protobuf 0.5.0

If you change your angular dependency to

angular2: ^2.0.0-alpha.44

or

angular2: 2.0.0-alpha.45

or

angular2: ^2.0.0-alpha

pub can resolve all dependencies just fine.

Answered By – Günter Zöchbauer

Answer Checked By – Marilyn (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.