aqueduct icon indicating copy to clipboard operation
aqueduct copied to clipboard

I use http.dart in aqueduct-4.0.0-b1,when I excute pub run aqueduct build,it shows error info below

Open chen412115 opened this issue 4 years ago • 1 comments

-- Aqueduct CLI Version: 4.0.0-b1 -- Aqueduct project version: 4.0.0-b1 Resolving ASTs... Generating runtime... Generated runtime at 'file:///D:/Project/dart_aqueduct/zhiyao_server/build/generated_runtime/'. Compiling package 'runtime'... Package 'runtime compiled to 'file:///D:/Project/dart_aqueduct/zhiyao_server/build/packages/runtime/'. Compiling package 'aqueduct'... Package 'aqueduct compiled to 'file:///D:/Project/dart_aqueduct/zhiyao_server/build/packages/aqueduct/'. Compiling package 'safe_config'... Package 'safe_config compiled to 'file:///D:/Project/dart_aqueduct/zhiyao_server/build/packages/safe_config/'. Copying application package (from 'file:///D:/Project/dart_aqueduct/zhiyao_server/')... Application packaged copied to 'file:///D:/Project/dart_aqueduct/zhiyao_server/build/packages/zhiyao_server/'. Fetching dependencies (--offline --no-precompile)... Finished fetching dependencies. Compiling... *** Uncaught error Bad state: Bad state: 'dart2native' failed with the following message: lib/utils/http_utils.dart:2:8: Error: Not found: 'package:http/http.dart' import 'package:http/http.dart' as Http; ^ lib/utils/http_utils.dart:9:10: Error: 'Response' isn't a type. Http.Response res = await Http.get(url,headers: header); ^^^^^^^^ lib/utils/http_utils.dart:9:31: Error: Method not found: 'get'. Http.Response res = await Http.get(url,headers: header); ^^^ Error: Could not resolve the package 'http' in 'package:http/http.dart'.

Failed to generate native files: Generating AOT kernel dill failed!

**** Stacktrace

  • #0 Build.compile (package:runtime/src/build.dart:138:7)
  • #1 Build.execute (package:runtime/src/build.dart:105:13)
  • #2 BuildExecutable.execute (data:application/dart:13:259)
  • #3 main (data:application/dart:9:35)
  • #4 _startIsolate. (dart:isolate-patch/isolate_patch.dart:297:32)
  • #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

chen412115 avatar Aug 25 '20 05:08 chen412115

What is your dart version? I use Dart 2.8.4 , it should work fine......with modfifications:

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

tedwong avatar Nov 23 '20 01:11 tedwong