flutter pub publish执行Ubuntu无限卡顿/Windows报Error 66问题求助
Flutter插件无法发布至pub.dev故障说明
环境
flutter pub version输出:Pub 2.14.3- 操作系统版本:Ubuntu 20.04 LTS、Windows 10 Pro 20H2
问题描述
基于plugin模板开发Flutter插件包,无法正常发布到pub.dev平台,具体故障表现如下:
Ubuntu系统故障
执行 flutter pub publish --dry-run -v 或 flutter pub pub publish --dry-run -v 命令,即便提前执行 flutter pub cache repair 和 flutter pub pub cache repair 清理缓存,命令运行到如下日志后就无限卡顿,静置1小时也无任何后续输出:
[ +11 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ ] stable [ +165 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. [ +6 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'WindowsUwpEngineArtifacts' 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. [ +145 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update. [ +1 ms] 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 'WindowsUwpEngineArtifacts' 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. [ +74 ms] Using /home/zues/snap/flutter/common/flutter/.pub-cache for the pub cache. [ ] executing: /home/zues/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/pub publish --dry-run -v FINE: Pub 2.14.3 FINE: Archiving and publishing Instance of 'Package'. MSG : Publishing lexactivator 3.0.0 to https://pub.dartlang.org: ***insert directory tree here FINE: Creating .tar.gz stream containing: ***insert project files here IO : Spawning "git --version" in /home/zues/lexactivator/. IO : Finished git. Exit code 0. | stdout: | | git version 2.17.1 | Nothing output on stderr. FINE: Determined git command git. IO : Spawning "git check-ignore --quiet ." in /home/zues/lexactivator/. IO : Finished git. Exit code 1. | Nothing output on stdout. | Nothing output on stderr. IO : Spawning "git ls-files --cached --exclude-standard --recurse-submodules" in /home/zues/lexactivator/. IO : Finished git. Exit code 0. | stdout: | | .gitignore | | CHANGELOG.md ***insert project files here | Nothing output on stderr.
项目根目录pubspec.yaml配置(非example目录下的pubspec文件)如下:
name: lexactivator description: LexActivator API wrapper for Dart. Integrates Crypltex's services into the Dart language. version: 3.0.0 homepage: https://cryptlex.com environment: sdk: ">=2.14.0 <3.0.0" flutter: ">=2.5.0" dependencies: flutter: sdk: flutter ffigen: ^4.0.0 dev_dependencies: flutter_lints: ^1.0.0 flutter: plugin: platforms: linux: pluginClass: LexactivatorPlugin macos: pluginClass: LexactivatorPlugin windows: pluginClass: LexactivatorPlugin
Windows系统故障
执行相同命令,会返回如下错误日志,最终退出码为66:
ERR : Directory listing failed, path = '.\example\windows\flutter\ephemeral\.plugin_symlinks\lexactivator\example\windows\flutter\ephemeral\.plugin_symlinks\lexactivator\example\windows\flutter\ephemeral\.plugin_symlinks\lexactivator\windows\include\lexactivator\*' (OS Error: The system cannot find the path specified. | , errno = 3) FINE: Exception type: FileSystemException FINE: dart:io _Directory.listSync | package:pub/src/validator/gitignore.dart 43:50 GitignoreValidator.validate.<fn> | package:pub/src/ignore.dart 293:28 Ignore.listFiles | package:pub/src/validator/gitignore.dart 41:43 GitignoreValidator.validate | package:pub/src/validator.dart 156:64 Validator.runAll.<fn> | dart:async Future.wait | package:pub/src/validator.dart 156:19 Validator.runAll | package:pub/src/command/lish.dart 245:21 LishCommand._validate | package:pub/src/command/lish.dart 219:15 LishCommand.runProtected | dart:async new Future.sync | package:pub/src/utils.dart 112:12 captureErrors.wrappedCallback | package:stack_trace Chain.capture | package:pub/src/utils.dart 125:11 captureErrors | package:pub/src/command.dart 171:13 PubCommand.run | package:args/command_runner.dart 209:27 CommandRunner.runCommand | package:pub/src/command_runner.dart 168:24 PubCommandRunner.runCommand | package:pub/src/command_runner.dart 153:20 PubCommandRunner.run | package:dartdev/dartdev.dart 45:56 runDartdev | C:\b\s\w\ir\cache\builder\sdk\pkg\dartdev\bin\dartdev.dart 11:9 main | ===== asynchronous gap =========================== | dart:async Future.catchError | package:pub/src/utils.dart 112:52 captureErrors.wrappedCallback | package:stack_trace Chain.capture | package:pub/src/utils.dart 125:11 captureErrors | package:pub/src/command.dart 171:13 PubCommand.run | package:args/command_runner.dart 209:27 CommandRunner.runCommand | package:pub/src/command_runner.dart 168:24 PubCommandRunner.runCommand | package:pub/src/command_runner.dart 153:20 PubCommandRunner.run | package:dartdev/dartdev.dart 45:56 runDartdev | C:\b\s\w\ir\cache\builder\sdk\pkg\dartdev\bin\dartdev.dart 11:9 main [+8233 ms] "flutter publish" took 8,334ms. [ +4 ms] pub finished with exit code 66 [ +2 ms] #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) #1 _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:391:7) <asynchronous suspension> #2 PackagesForwardCommand.runCommand (package:flutter_tools/src/commands/packages.dart:247:5) <asynchronous suspension> #3 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27) <asynchronous suspension> #4 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19) <asynchronous suspension> #5 CommandRunner.runCommand (package:args/command_runner.dart:209:13) <asynchronous suspension> #6 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9) <asynchronous suspension> #7 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19) <asynchronous suspension> #8 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5) <asynchronous suspension> #9 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9) <asynchronous suspension> #10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19) <asynchronous suspension> #11 main (package:flutter_tools/executable.dart:92:3) <asynchronous suspension> [ +236 ms] ensureAnalyticsSent: 229ms [ +6 ms] Running shutdown hooks [ +1 ms] Shutdown hooks complete [ +1 ms] exiting with code 66
预期行为与排查情况
目前公开渠道可查询到的 flutter pub publish 命令细节说明较少,按照现有公开资料,预期该命令要么执行成功,要么返回明确错误提示。但当前Ubuntu下无响应卡顿、Windows下返回的错误无对应参考资料。
最初使用Flutter dev渠道版本,误以为是版本不稳定导致的问题,切换到stable渠道并重建项目后问题仍未解决。
内容的提问来源于stack exchange,提问作者azan-n
相关产品推荐
相关产品推荐

