You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

国内上传Dart包至pub.dev遇Connection closed错误(exit code 69)求助

上传Dart包至pub.dev时遇"Connection closed before full header was received"错误求助

身处中国,尝试将Dart包上传至pub.dev时,始终返回以下错误:

Connection closed before full header was received
pub finished with exit code 69

已尝试的无效解决方法

  • 设置终端代理:
    $ export http_proxy=http://127.0.0.1:7890
    $ export https_proxy=$http_proxy
    
    $ curl google.com
    <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
    <TITLE>301 Moved</TITLE></HEAD><BODY>
    <H1>301 Moved</H1>
    The document has moved
    <A HREF="http://www.google.com/">here</A>.
    </BODY></HTML>
    
  • 编辑~/.bash_profile(已注释国内镜像配置):
    # export PUB_HOSTED_URL=https://pub.flutter-io.cn
    # export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
    
    执行$ source ~/.bash_profile使配置生效。
  • 尝试不同上传命令:
    $ flutter packages pub publish --server=https://pub.dartlang.org
    $ flutter pub publish --server=https://pub.dev
    
    ...
    # 返回错误
    Connection closed before full header was received
    pub finished with exit code 69
    

Flutter环境检测结果

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.9, on macOS 12.6.1 21G217 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.75.1)
[✓] Proxy Configuration
[✓] Connected device (3 available)
[✓] HTTP Host Availability

内容的提问来源于stack exchange,提问作者张英姿

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 20:10:36