Flutter build runner - pub 完成,退出代码为 65

Flutter build runner - pub finished with exit code 65

编辑 3 这一定是一个 font_awesome_flutter 问题。当我在 pubspec.yaml 中保留 dependency_overrides 但删除 font_awesome_flutter 参数时,只需这样做:

dependency_overrides:

有效。

我升级到 flutter 2.0,现在当我尝试 运行 flutter pub run build_runner watch --delete-conflicting-outputs:

时出现此错误
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
pub finished with exit code 65

知道如何解决吗?我有 运行 flutter pub getpub get 很多次。

pubspec.yaml:

    name: vepo
description: The Vepo mobile app.
publish_to: "none"
version: 1.0.0+1

environment:
  sdk: '>=2.12.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  animate_do: ^2.0.0
  cloud_firestore: ^1.0.1
  dio: ^4.0.0
  enum_to_string: ^2.0.1
  firebase_analytics: ^7.1.1
  firebase_auth: ^1.0.1
  firebase_core: ^1.0.1
  flash: ^1.5.1
  flutter_hooks: ^0.16.0
  flutter_icons: ^1.1.0
  flutter_launcher_icons: ^0.9.0
  flutter_native_splash: ^1.1.7+1
  flutter_riverpod: ^0.13.1+1
  flutter_typeahead: ^3.1.1
  font_awesome_flutter: ^9.0.0
  freezed: ^0.14.1+2
  freezed_annotation: ^0.14.1
  google_fonts: ^2.0.0
  google_maps_webservice: ^0.0.20-nullsafety.2
  hive: ^2.0.2
  hive_flutter: ^1.0.0
  hive_generator: ^1.0.1
  hooks_riverpod: ^0.13.1+1
  http: ^0.13.1
  image_cropper: ^1.4.0
  image_picker: ^0.7.4
  json_annotation: ^4.0.1
  json_serializable: ^4.1.0
  keyboard_avoider: ^0.1.2
  logger: ^1.0.0
  reactive_forms: ^10.0.3
  rxdart: ^0.26.0
  smooth_page_indicator: ^0.2.3
  uuid: ^3.0.3

dependency_overrides:
  font_awesome_flutter:
    path: /Users/benjaminfarquhar/dev/font_awesome_flutter-master

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.11.1
  flutter_gen: ^3.0.2
  pedantic: ^1.11.0

flutter:
  uses-material-design: true
  fonts:
    - family: VarelaRound
      fonts:
        - asset: assets/fonts/VarelaRound-Regular.ttf
    - family: Hind
      fonts:
        - asset: assets/fonts/Hind-Medium.ttf
  assets:
    - assets/images/

flutter_gen:
  output: lib/

flutter_icons:
  image_path: "assets/images/launcher_icon_ios.webp"
  android: false
  ios: true

flutter_native_splash:
  image: assets/images/splash_screen.png
  color: "#22F2A6"

--verbose 添加到 flutter pub run build_runner build:

[ +114 ms] executing: [/Users/benjaminfarquhar/development/flutter/] git -c log.showSignature=false log -n 1
--pretty=format:%H
[  +71 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
[        ] executing: [/Users/benjaminfarquhar/development/flutter/] git tag --points-at
c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
[  +27 ms] Exit code 0 from: git tag --points-at c5a4b4029c0798f37c4a39b479d7cb75daa7b05c
[        ] 2.0.1
[  +59 ms] executing: [/Users/benjaminfarquhar/development/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +15 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [/Users/benjaminfarquhar/development/flutter/] git ls-remote --get-url origin
[  +15 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +71 ms] executing: [/Users/benjaminfarquhar/development/flutter/] git rev-parse --abbrev-ref HEAD
[  +30 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[   +9 ms] executing: sw_vers -productName
[  +21 ms] Exit code 0 from: sw_vers -productName
[        ] macOS
[        ] executing: sw_vers -productVersion
[  +20 ms] Exit code 0 from: sw_vers -productVersion
[        ] 11.2.2
[        ] executing: sw_vers -buildVersion
[  +24 ms] Exit code 0 from: sw_vers -buildVersion
[        ] 20D80
[   +9 ms] executing: sysctl hw.optional.arm64
[  +12 ms] Exit code 1 from: sysctl hw.optional.arm64
[        ] sysctl: unknown oid 'hw.optional.arm64'
[  +98 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +58 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[  +49 ms] Using /Users/benjaminfarquhar/development/flutter/.pub-cache for the pub cache.
[        ] executing: /Users/benjaminfarquhar/development/flutter/bin/cache/dart-sdk/bin/pub run build_runner --verbose
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
[ +621 ms] "flutter run" took 755ms.
[  +24 ms] pub finished with exit code 65
[  +17 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:364:7)
           <asynchronous suspension>
           #2      PackagesForwardCommand.runCommand (package:flutter_tools/src/commands/packages.dart:238:5)
           <asynchronous suspension>
           #3      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:1009:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
           <asynchronous suspension>
           #7      CommandRunner.runCommand (package:args/command_runner.dart:197:13)
           <asynchronous suspension>
           #8      FlutterCommandRunner.runCommand.<anonymous closure>
           (package:flutter_tools/src/runner/flutter_command_runner.dart:278:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
           <asynchronous suspension>
           #11     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:234:5)
           <asynchronous suspension>
           #12     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
           <asynchronous suspension>
           #13     run.<anonymous closure> (package:flutter_tools/runner.dart:62:12)
           <asynchronous suspension>
           #14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #15     AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
           <asynchronous suspension>
           #16     runInContext (package:flutter_tools/src/context_runner.dart:73:10)
           <asynchronous suspension>
           #17     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>
           
           
[ +265 ms] ensureAnalyticsSent: 254ms
[   +3 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 65

尝试以下命令

flutter pub cache repair

您的问题可能与以下导入有关

  flutter_gen: ^3.0.2

我在这里的分析是在另一个包上使用 dependency_overrides 实现(我使用 image_cropper),我遇到了完全相同的问题。

我没有使用过这个库,所以我不能帮到你更多,但我在官方 Flutter Github 上看到了问题,提到了这个库以及它在编辑 pubspec 时可能产生的问题文件。

编辑
因为它可能会在未来帮助很多人,所以我在 flutter_gen Github

上创建了一个问题

编辑 2
flutter_gen 包的贡献者回答了 Github 问题。
您必须将 flutter_gen 导入替换为 flutter_gen_runner

flutter_gen_runner: ^3.0.2

尝试以下几行

flutter_icons: android: true ios: true image_path: "assets/logo/cup.png" adaptive_icon_background : "#fff" adaptive_icon_foreground : "assets/logo/cup.png"

我创建了“资产”文件夹并放置了“cup.png”(任何图标图像)