当我尝试运行
dart run build_runner build --delete-conflicting-output
时,我有以下输出:
Failed to build build_runner:build_runner:
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/bootstrap.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/bootstrap.dart': No such file or directory
export 'package:_macros/src/bootstrap.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/executor.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/executor.dart': No such file or directory
export 'package:_macros/src/executor.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/executor/isolated_executor.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/executor/isolated_executor.dart': No such file or directory
export 'package:_macros/src/executor/isolated_executor.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/executor/multi_executor.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/executor/multi_executor.dart': No such file or directory
export 'package:_macros/src/executor/multi_executor.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/executor/process_executor.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/executor/process_executor.dart': No such file or directory
export 'package:_macros/src/executor/process_executor.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/executor/serialization.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/executor/serialization.dart': No such file or directory
export 'package:_macros/src/executor/serialization.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/macros.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/api.dart': No such file or directory
export 'package:_macros/src/api.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/executor/introspection_impls.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/executor/introspection_impls.dart': No such file or directory
export 'package:_macros/src/executor/introspection_impls.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/executor/response_impls.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/executor/response_impls.dart': No such file or directory
export 'package:_macros/src/executor/response_impls.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/executor/exception_impls.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/executor/exception_impls.dart': No such file or directory
export 'package:_macros/src/executor/exception_impls.dart';
^
../../../.pub-cache/hosted/pub.dev/macros-0.1.2-main.4/lib/src/executor/remote_instance.dart:5:1: Error: Error when reading '../../../fvm/versions/stable/bin/cache/dart-sdk/pkg/_macros/lib/src/executor/remote_instance.dart': No such file or directory
export 'package:_macros/src/executor/remote_instance.dart';
^
../../../.pub-cache/hosted/pub.dev/analyzer-6.7.0/lib/src/summary2/macro.dart:24:10: Error: Type 'macro.MacroInstanceIdentifier' not found.
Future<macro.MacroInstanceIdentifier> instantiate({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/analyzer-6.7.0/lib/src/summary2/macro.dart:28:14: Error: Type 'macro.Arguments' not found.
required macro.Arguments arguments,
^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/analyzer-6.7.0/lib/src/summary2/macro.dart:35:14: Error: Type 'macro.ExecutorFactoryToken' not found.
late final macro.ExecutorFactoryToken _executorFactoryToken;
^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/analyzer-6.7.0/lib/src/summary2/macro.dart:58:10: Error: Type 'macro.MacroInstanceIdentifier' not found.
Future<macro.MacroInstanceIdentifier> instantiate({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/analyzer-6.7.0/lib/src/summary2/macro.dart:62:14: Error: Type 'macro.Arguments' not found.
required macro.Arguments arguments,
^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/analyzer-6.7.0/lib/src/summary2/macro.dart:116:14: Error: Type 'macro.ExecutorFactoryToken' not found.
late final macro.ExecutorFactoryToken _executorFactoryToken;
^^^^^^^^^^^^^^^^^^^^^^^^^^
...
build_runner:^2.4.12 以及最新版本的所有生成器injectable_generator、retrofit_generator、json_serialized 和drift_dev。
我尝试清理 dart 缓存但没有成功。
这里的主要问题是缺少作为 Dart SDK 一部分的文件(第一个通道错误,
bootstrap.dart
等)。更新后可能会发生这种情况,因为 Dart SDK 和二进制文件不会立即下载。您只需运行 flutter doctor
即可下载依赖项。在实际 doctor
输出之前,您将在终端中看到类似的内容:
~ flutter doctor
Downloading Darwin arm64 Dart SDK from Flutter engine b8800d88be4866db1b15f8b954ab2573bba9960f...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
97 201M 97 197M 0 0 11.3M 0 0:00:17 0:00:17 --:--:-- 12.2M
之后,这些文件将可用。