Flutter build runner - pub 以退出代码 65 结束

Posted

技术标签:

【中文标题】Flutter build runner - pub 以退出代码 65 结束【英文标题】:Flutter build runner - pub finished with exit code 65 【发布时间】:2021-06-04 19:02:50 【问题描述】:

EDIT 3 这一定是font_awesome_flutter 问题。当我将 dependency_overrides 留在 pubspec.yaml 中但删除 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 clean”,然后再运行“flutter pub get” @tanharpatel 不幸的是,它没有修复它。不过还是谢谢。 @BeniaminoBaggins 更新了我的答案,可能会解决您的问题! 试试dart pub get 【参考方案1】:

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

  flutter_gen: ^3.0.2

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

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

编辑 由于以后可能对很多人有帮助,所以我在flutter_gen Github上创建了一个问题

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

flutter_gen_runner: ^3.0.2

【讨论】:

是的,完美。包名称更改后第一次工作。非常感谢。【参考方案2】:

试试下面的命令

flutter pub cache repair

【讨论】:

【参考方案3】:

试试下面几行

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

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

【讨论】:

以上是关于Flutter build runner - pub 以退出代码 65 结束的主要内容,如果未能解决你的问题,请参考以下文章

使用 json_serializable (flutter packages pub run build_runner build) 问题

Flutter 无法使用 Freezed 构建 build_runner

为啥 build_runner 在 dart/flutter 中序列化 JSON 时不生成文件

flutter pub run build_runner build 时出错

Flutter build runner - pub 以退出代码 65 结束

[Flutter] Flutter 的 build 系统