8

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

一切都很好,跟着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.

其他一些在安装过程中遇到相同网络中断的项目也存在同样的问题。

到目前为止喜欢这种语言,而不是包管理:(

4

3 回答 3

4

Cabal 沙箱经常被推荐用于开发,但在快速尝试某些包时效果很好。如果出现任何问题,它们很容易被丢弃,并且不会影响您已经安装的任何其他软件包。这是我要尝试的方法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运行测试或cabal repl运行ghci与可用沙箱包的会话。

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

于 2014-02-15T10:45:42.737 回答
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

于 2014-02-15T03:49:37.047 回答
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

于 2015-06-23T12:07:25.150 回答