决定学习Haskell,通过Homebrew在OS X上安装了ghc(当时没有下载Web二进制文件)。
一切都很棒,跟随学习你一个哈斯克尔,但后来决定安装一些软件包,看看事情是如何运行的。
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.
其他一些在安装过程中遇到相同网络中断的项目也存在相同的问题。
到目前为止,喜欢这门语言,而不是包管理:(
阴谋集团沙箱经常被推荐用于开发,但对于快速尝试一些软件包来说效果很好。如果出现任何问题,它们很容易一次性使用,不会影响您已经安装的任何其他软件包。以下是我会尝试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
来恢复沙盒。完成后,您可以安全地删除沙盒,而不会影响其他包。
这是过去对我有用的东西对于包$f,请执行
ghc-pkg.exe unregister --global --force $f
ghc-pkg.exe recache
根据其文档,ghc-pkg.exe unregister
"注销包"并重新缓存"重新生成包数据库缓存"。 如果相关软件包安装在系统目录中,则需要使用--global
。
如果数据库严重损坏,我会删除用户或系统阴谋集团目录并重新安装我拥有的软件包。我通常通过cabal install
我使用的一个或几个应用程序库来执行此操作,并让cabal
重新安装依赖项。注意:阴谋集团目录取决于GHC的操作系统和版本。
GHC-PKG 取消注册 --Force clckwrks-cli
我在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
)