haskell - Cabal更新 "premature end of compressed stream"错误

标签 haskell zlib cabal cabal-install

我的 cabal 实例,每当我尝试运行 cabal updatecabal install foo 时都会出现错误:

从 hackage.haskell.org 下载最新的软件包列表 cabal:Codec.Compression.Zlib:压缩流过早结束

我正在运行 cabal 版本 1.22.0.0 和 GHC 版本 7.8.4。我使用的是 Arch Linux,并使用官方存储库中的标准 haskell 包。

运行cabal update -v3(删除~/.cabal/后)时的完整错误是:

Config file path source is default config file.
Config file /home/username/.cabal/config not found.
Writing default configuration to /home/username/.cabal/config
Downloading the latest package list from hackage.haskell.org
Sending:
GET /packages/archive/00-index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.22.0.0 (linux; x86_64)

Creating new connection to hackage.haskell.org
Received:
HTTP/1.0 301 Moved Permanently
Server: nginx/1.6.2
Content-Type: text/plain; charset=UTF-8
Location: /packages/index.tar.gz
Accept-Ranges: bytes
Date: Thu, 12 Feb 2015 19:15:22 GMT
Via: 1.1 varnish
X-Served-By: cache-jfk1033-JFK
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1423768522.169450,VS0,VE77
X-Cache: MISS from none
X-Cache-Lookup: MISS from none:3128
Connection: close

301 - redirect
Redirecting to http://hackage.haskell.org/packages/index.tar.gz ...
Sending:
GET /packages/index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.22.0.0 (linux; x86_64)

Creating new connection to hackage.haskell.org
Received:
HTTP/1.0 200 OK
Server: nginx/1.6.2
Content-Type: application/x-gzip
Cache-Control: public, no-transform, max-age=300
Content-MD5: f1640f2ce5cbf266c91d4062ea470689
ETag: "f1640f2ce5cbf266c91d4062ea470689"
Last-Modified: Thu, 12 Feb 2015 19:07:27 GMT
Content-Length: 8825306
Accept-Ranges: bytes
Date: Thu, 12 Feb 2015 19:15:22 GMT
Via: 1.1 varnish
Age: 84
X-Served-By: cache-jfk1023-JFK
X-Cache: HIT
X-Cache-Hits: 1
X-Timer: S1423768522.419600,VS0,VE49
X-Cache: MISS from none
X-Cache-Lookup: MISS from none:3128
Connection: close

Downloaded to /home/username/.cabal/packages/hackage.haskell.org/00-index.tar.gz
cabal: Codec.Compression.Zlib: premature end of compressed stream

网上有一些对此的引用,但其中很多都非常旧,而且我仍然遇到这个问题。我是大学网络的幕后黑手,我觉得这可能是问题的一部分,但我想深入了解并了解正在发生的事情。提前致谢!

最佳答案

在找到实际的解决方案之前,我想发布一个解决方法,以帮助其他遇到此问题的人:

  • 转到下载索引的位置(在我的计算机上,它位于目录 ~/.cabal/packages/hackage.haskell.org/)

  • 然后手动下载该文件,例如使用 wget:wget http://hackage.haskell.org/packages/archive/00-index.tar.gz (文件名可能不同,因此请务必检查您的 cabal 在尝试更新时输出的内容)

  • 最后,使用gunzip 00-index.tar.gz解压文件

  • 现在您可以cabal install软件包了。

这在我的机器上有效,这样索引就可以每隔一段时间手动更新一次。不过要小心,因为手动下载后运行“cabal update”可能会搞砸,尽管我不确定是否一定会这样。

关于haskell - Cabal更新 "premature end of compressed stream"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28485981/

相关文章:

haskell - 默认库中有bindN吗?

c# - zlib.c Adler 实现和 Deflate、Ionic Deflate 之间的 Zlib 压缩差异

linux - "libz.so.1: cannot open shared object file: No such file or directory"

haskell - 处理函数式编程中增量数据建模的变化

arrays - 由有界数据类型索引的 Repa 数组?

node.js - zlib:zlib 绑定(bind)​​已关闭

haskell - Cabal损坏的重新安装是否有解决方法?

haskell - 如何在 haskell+cabal 中配置构建依赖项?

haskell - 有没有办法找到 .cabal 文件的所有正确依赖版本范围?

haskell - Haskell 中不错的小型简单现实生活编程示例?