我只是尝试用和3个月前一样的命令生成我的文件(我不太擅长后端和devops),现在它不再生成文件了。它告诉我使用delete命令(我不记得了),但是即使使用这个命令,我的文件也不会生成。这就是我的日志的样子,下面您可以找到一个简单类的代码。
我的猜测之一是,这与我更改我的github帐户有关,因为有提到的权限问题。
我正在使用windows 10中的vs代码。
日志文件:
E:\1 Work\flutter_pilot> flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 336ms
[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 12.5s
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 787ms
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Found 13 declared outputs which already exist on disk. This is likely because the`.dart_tool/build` folder was deleted, or you are submitting generated files to your source repository.
[SEVERE] Conflicting outputs were detected and the build is unable to prompt for permission to remove them. These outputs must be removed manually or the build can be run with `--delete-conflicting-outputs`. The outputs are: lib/models/advisory-service-item.g.dart
lib/models/advisory-service.g.dart
lib/models/auth.g.dart
lib/models/contract.g.dart
lib/models/contributor.g.dart
lib/models/exact-cost-values.g.dart
lib/models/exact-cost.g.dart
lib/models/expert.g.dart
lib/models/paginator-info.g.dart
lib/models/person.g.dart
lib/models/project.g.dart
lib/models/system-country.g.dart
lib/models/user.g.dart
pub failed (78)
类文件:
import 'package:json_annotation/json_annotation.dart';
part 'organisation.g.dart';
@JsonSerializable()
class Organisation {
final String name;
Organisation({this.name});
factory Organisation.fromJson(Map<String, dynamic> json) => _$OrganisationFromJson(json);
Map<String, dynamic> toJson() => _$OrganisationToJson(this);
}
发布于 2022-08-25 13:46:41
将部件和类更改为文件的同名解决了问题
发布于 2020-05-15 05:49:06
我也遇到过类似的问题,但我使用的是,我完成了以下步骤:
文件=>使缓存失效/重新启动
运行以下命令:
flutter clean
flutter pub get
flutter packages pub run build_runner build --delete-conflicting-outputs
关于--delete-conflicting-outputs
假设用户包中有冲突的输出来自以前的构建,并跳过通常将提供的用户提示。
发布于 2020-01-09 17:52:42
如果仔细阅读错误消息,您将看到它要求您尝试在命令末尾添加--delete-conflicting-outputs
。所以你应该试试flutter packages pub run build_runner build --delete-conflicting-outputs
。
https://stackoverflow.com/questions/59668548
复制相似问题