aqueduct icon indicating copy to clipboard operation
aqueduct copied to clipboard

Analyzer 0.41.0 breaks activating aqueduct 4.0.0-b1

Open igotyou opened this issue 5 years ago • 18 comments

As title says. It's currently not possible to run 'pub global activate aqueduct'. I have found out that this is due to the analyzer dependency. Version 0.41.0 breaks aqueduct, cloning aqueduct and changing the pubspec file to exclude 0.41.0 fixes the error.

igotyou avatar Nov 15 '20 12:11 igotyou

Is the project not maintain any more? I find that the 4.0.0-b1 is not update for a long long time.

tedwong avatar Nov 22 '20 11:11 tedwong

Good question. It does seem like it's been a long while since there was any activity in this repository.

igotyou avatar Nov 22 '20 11:11 igotyou

@igotyou do u able to fix the issue? I comment out the analyzer, but it can't run aqueduct db generate anymore.

tedwong avatar Nov 22 '20 12:11 tedwong

don't comment out analyzer. Specify the version, like such: analyzer: '>=0.39.4 <0.41.0'

igotyou avatar Nov 22 '20 16:11 igotyou

@igotyou I finally resolve this issue.....Thanks...I also provide a detail guidelines on how to fix it for someone encounter this issue:

https://github.com/stablekernel/aqueduct/issues/916

tedwong avatar Nov 23 '20 01:11 tedwong

Where do you change the version? is it in the pubspect.lock file?

luigiRP avatar Nov 23 '20 18:11 luigiRP

@luigiRP no. The pubspec.yaml file in /aqueduct. An alternative is to simply download my branch https://github.com/igotyou/aqueduct/ (The only difference is fixing that analyzer dependency). Install it via pub global activate --source path <insert path to base of downloaded repository>/aqueduct.

igotyou avatar Nov 23 '20 19:11 igotyou

Hey! Thanks for responding. I downloaded your branch and updated the dependencies. When I run aqueduct db generate I still get the error with the analyser, I guess I have to go to the code and change the version.

luigiRP avatar Nov 24 '20 11:11 luigiRP

Changed the version, but I still get the same error. I don't know if I did something wrong, last week my database was working perfectly.

Error: -- Aqueduct CLI Version: 4.0.0-b1 -- Aqueduct project version: 4.0.0-b1 *** Uncaught error IsolateSpawnException: Unable to spawn isolate: ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:6:8: Error: Error when reading '../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.0/lib/analyzer.dart': No such file or directory import 'package:analyzer/analyzer.dart'; ^ ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:52:17: Error: Type 'ClassDeclaration' not found. static Future<ClassDeclaration> _getClass(Type type) async { ^^^^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:54:22: Error: Method not found: 'parseDartFile'. final fileUnit = parseDartFile(uri.toFilePath(windows: Platform.isWindows)); ^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:58:28: Error: 'ClassDeclaration' isn't a type. .where((u) => u is ClassDeclaration) ^^^^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:59:28: Error: 'ClassDeclaration' isn't a type. .map((cu) => cu as ClassDeclaration) ^^^^^^^^^^^^^^^^ **** Stacktrace


luigiRP avatar Nov 24 '20 11:11 luigiRP

@luigiRP

try this:

#916

tedwong avatar Nov 24 '20 11:11 tedwong

How do you install fd_console? I didn't understand the readme. I tried using: "brew install dart 2.8.4" but I get the following error: ==> Searching for similarly named formulae... Error: No similarly named formulae found. Error: No available formula or cask with the name "2.8.4". ==> Searching for a previously deleted formula (in the last month)... Error: No previously deleted formula found. ==> Searching taps on GitHub... Error: No formulae found in taps.

luigiRP avatar Nov 24 '20 11:11 luigiRP

You don't need all that fd_console stuff. Just make sure that the pubspec.yaml file in your project has analyzer: '>=0.39.4 <0.41.0'

igotyou avatar Nov 24 '20 12:11 igotyou

I did, I downloaded this branch https://github.com/igotyou/aqueduct/ , activated the path to this branch, made sure the pub spec.yaml file has those analyzer versions and I get this error: Error: -- Aqueduct CLI Version: 4.0.0-b1 -- Aqueduct project version: 4.0.0-b1 *** Uncaught error IsolateSpawnException: Unable to spawn isolate: ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:6:8: Error: Error when reading '../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.0/lib/analyzer.dart': No such file or directory import 'package:analyzer/analyzer.dart'; ^ ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:52:17: Error: Type 'ClassDeclaration' not found. static Future _getClass(Type type) async { ^^^^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:54:22: Error: Method not found: 'parseDartFile'. final fileUnit = parseDartFile(uri.toFilePath(windows: Platform.isWindows)); ^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:58:28: Error: 'ClassDeclaration' isn't a type. .where((u) => u is ClassDeclaration) ^^^^^^^^^^^^^^^^ ../../../../.pub-cache/hosted/pub.dartlang.org/isolate_executor-2.0.2+3/lib/src/source_generator.dart:59:28: Error: 'ClassDeclaration' isn't a type. .map((cu) => cu as ClassDeclaration) ^^^^^^^^^^^^^^^^ **** Stacktrace

Aqueduct --version runs perfectly but this happens when I try to generate my database. If you look at that branch the analyzer is exactly as you said: analyzer: "'>=0.39.4 <0.41.0' "

luigiRP avatar Nov 24 '20 12:11 luigiRP

Im noticing that you said "the pubspect.yaml file in your project " . My pubspect.yaml file in my project doesn't have an analyzer but my aqueduct version those, does that mean that I need to put it also in my project?

luigiRP avatar Nov 24 '20 12:11 luigiRP

Well your project does depend on aqueduct, and thereby by proxy on analyzer, that's why you're seeing that issue. Add the analyzer to your pubspec to override the aqueduc'ts dependency and thereby fix your problem.

Remember that you have both the aqueduct CLI version, and the project aqueduct version. By installing my repo via pub global you have fixed the CLI. To fix the project aqueduct you have to add the analyzer depency to your project's pubspec, or make the aqueduct dependency link to my github

igotyou avatar Nov 24 '20 13:11 igotyou

Oh! I didn't know you had to add it as a dependency as well. I can finally create my database! Thank you so much, and sorry for the bother!

luigiRP avatar Nov 24 '20 13:11 luigiRP

Thanks for this! Looks like it's been a well since there was a commit. I do recall them saying in slack that with COVID, things are a little harder/slower but hopefully the project picks up steam again soon!

Aldo111 avatar Jan 29 '21 07:01 Aldo111

The problem with the analyzer arises because the api has changed in the latest versions. To fix this :

  1. Edit pubspec.yaml in the C:\Users\currenUser\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\aqueduct-4.0.0-b1

dependencies: analyzer: ^0.39.4

dev_dependencies: aqueduct_test: 2.0.0-b1 (in folder pub.dartlang.org i have this version of aqueduct_test)

  1. Make "pub get" inside this current folder for the Aqueduct to pull up new dependencies.
  2. Now you can install it globally - "pub global activate aqueduct 4.0.0-b1"
  3. Checking the version - "aqueduct " - And you should see this ... -- Aqueduct CLI Version: 4.0.0-b1

zaidite avatar Feb 06 '21 13:02 zaidite