如何重置Haskell包缓存

时间:2014-02-15 01:55:30

标签: haskell cabal package-management

决定学习Haskell,通过Homebrew在OS X上安装了ghc(Web二进制文件当时没有下载)。

一切都很好,跟着Learn You a Haskell,然后决定安装一些软件包,看看事情是如何运行的。

cabal install clckwrks-cli运行良好,直到......

公共互联网在安装/构建一些项目的过程中中断了。

现在,这些程序都不会重新安装,在clckwrks-cli的情况下,我收到以下错误:

$ cabal install clckwrks-cli --reinstall --force-reinstalls
Resolving dependencies...
Failed to install cipher-aes-0.2.6
Failed to install cipher-rc4-0.1.4
Failed to install cookie-0.4.0.1
Failed to install crypto-numbers-0.2.3
Configuring happstack-hsp-7.2.4...
Building happstack-hsp-7.2.4...
Preprocessing library happstack-hsp-7.2.4...
ghc: could not execute: hsx2hs
Failed to install happstack-hsp-7.2.4
Failed to install lifted-base-0.2.2.0
Failed to install publicsuffixlist-0.1
Failed to install pwstore-purehaskell-2.1.1
Configuring reform-hsp-0.2.4...
Building reform-hsp-0.2.4...
Preprocessing library reform-hsp-0.2.4...
ghc: could not execute: hsx2hs
Failed to install reform-hsp-0.2.4
Failed to install web-plugins-0.2.5
Failed to install wl-pprint-text-1.1.0.2
Failed to install xml-types-0.3.4
cabal: Error: some packages failed to install:
attoparsec-conduit-1.0.1.2 depends on lifted-base-0.2.2.0 which failed to
install.
authenticate-1.3.2.6 depends on xml-types-0.3.4 which failed to install.
blaze-builder-conduit-1.0.0 depends on lifted-base-0.2.2.0 which failed to
install.
cipher-aes-0.2.6 failed while unpacking the package. The exception was:
user error (data is not in tar format)
cipher-rc4-0.1.4 failed while unpacking the package. The exception was:
user error (data is not in tar format)
clckwrks-0.21.1 depends on xml-types-0.3.4 which failed to install.
clckwrks-cli-0.2.10 depends on xml-types-0.3.4 which failed to install.
conduit-1.0.14 depends on lifted-base-0.2.2.0 which failed to install.
cookie-0.4.0.1 failed while unpacking the package. The exception was:
user error (data is not in tar format)
cprng-aes-0.5.2 depends on cipher-aes-0.2.6 which failed to install.
crypto-numbers-0.2.3 failed while unpacking the package. The exception was:
user error (data is not in tar format)
crypto-pubkey-0.2.4 depends on crypto-numbers-0.2.3 which failed to install.
fb-0.14.11 depends on publicsuffixlist-0.1 which failed to install.
happstack-authenticate-0.10.10 depends on xml-types-0.3.4 which failed to
install.
happstack-hsp-7.2.4 failed during the building phase. The exception was:
ExitFailure 1
hsx-jmacro-7.3.4 depends on wl-pprint-text-1.1.0.2 which failed to install.
http-conduit-1.9.6 depends on publicsuffixlist-0.1 which failed to install.
jmacro-0.6.8 depends on wl-pprint-text-1.1.0.2 which failed to install.
lifted-base-0.2.2.0 failed while unpacking the package. The exception was:
user error (data is not in tar format)
monad-logger-0.3.4.0 depends on lifted-base-0.2.2.0 which failed to install.
publicsuffixlist-0.1 failed while unpacking the package. The exception was:
user error (data is not in tar format)
pwstore-purehaskell-2.1.1 failed while unpacking the package. The exception
was:
user error (data is not in tar format)
reform-hsp-0.2.4 failed during the building phase. The exception was:
ExitFailure 1
resourcet-0.4.10 depends on lifted-base-0.2.2.0 which failed to install.
tls-1.1.5 depends on crypto-numbers-0.2.3 which failed to install.
tls-extra-0.6.6 depends on crypto-numbers-0.2.3 which failed to install.
web-plugins-0.2.5 failed while unpacking the package. The exception was:
user error (data is not in tar format)
wl-pprint-text-1.1.0.2 failed while unpacking the package. The exception was:
user error (data is not in tar format)
xml-conduit-1.1.0.9 depends on xml-types-0.3.4 which failed to install.
xml-types-0.3.4 failed while unpacking the package. The exception was:
user error (data is not in tar format)
zlib-conduit-1.0.0 depends on lifted-base-0.2.2.0 which failed to install.

与安装中期遭遇相同网络中断的其他一些项目相同的问题。

到目前为止爱语言,而不是包裹管理:(

3 个答案:

答案 0 :(得分:3)

Cabal sandboxes经常被推荐用于开发,但是可以快速尝试一些软件包。如果出现任何问题,它们很容易丢弃,不会影响您已安装的任何其他包装。以下是我要做的尝试clckwrks-cli(顺便说一下,如果你想尝试任何一个包,你可以选择另一个包含较少依赖的包)。

$ cd /path/to/sandboxes
$ cabal get clckwrks-cli
$ cd clckwrks-cli-<version>
$ cabal sandbox init
$ cabal install --only-dependencies -j<N> # N is the number of CPU cores

此时,您可以键入cabal run来运行程序包安装的可执行文件(可能位于./dist/build/bin/),cabal test运行测试,或{{1为了使用可用的沙箱包运行cabal repl会话。

如果出现任何问题,您可以通过键入ghcicabal sandbox delete来恢复沙箱。完成后,您可以安全地删除沙箱,而不会影响其他包。

答案 1 :(得分:1)

这是过去对我有用的东西 对于包$ f,请执行

ghc-pkg.exe unregister --global --force $f
ghc-pkg.exe recache

根据其文档,ghc-pkg.exe unregister“取消注册包”并重新缓存“重新生成包数据库缓存”。如果有问题的软件包安装在系统目录中,则需要使用--global

如果数据库严重损坏,我会删除用户或系统cabal目录并重新安装我拥有的软件包。我通常通过cabal install我使用的一个或多个应用程序库执行此操作,并让cabal重新安装依赖项。注意:cabal目录取决于操作系统和GHC的版本。


ghc-pkg取消注册--force clckwrks-cli

答案 2 :(得分:0)

我在使用unordered-containers-0.2.5.1时遇到问题并删除了文件:

~/.cabal/packages/hackage.haskell.org/unordered-containers/0.2.5.1/unordered-containers-0.2.5.1.tar.gz

为我解决了这个问题。 (即错误cabal: data is not in tar format