5

我正在尝试在新的 Ubuntu 16.04 实例上设置Hakyll,但我似乎无法正确获取基于堆栈的设置说明。

从 开始stack install hakyll,我得到:

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for hakyll-4.9.3.0:
    http-conduit-2.1.11 must match >=2.2 && <2.3 (latest applicable is 2.2.3)

Plan construction failed.

我在绑定到时遇到了类似的错误stack-install http-conduit-2.1.11,这次是:

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for http-conduit-2.2.3:
    http-client-0.4.31.2 must match >=0.5 && <0.6 (latest applicable is 0.5.5)
    http-client-tls-0.2.4.1 must match >=0.3 && <0.4 (latest applicable is 0.3.3.1)

Plan construction failed.

在解决了这个依赖项(也使用堆栈)之后,我再次尝试了stack install http-conduit-2.1.11,但我再次遇到了相同的依赖项错误。

http-client-0.4.31.2http-client-tls-0.2.4.1出现在 my~/.stack/precompiled/x86_64-linux/ghc-8.0.1/1.24.0.0/中,这并没有明确地出现在 my 中$PATH,但这感觉像是一个非常 hacky 的解决方案,而且我还没有找到任何推荐这种方法的文档。

如何在我的机器上正确安装 Hakyll?

4

2 回答 2

3

使用堆栈的依赖管理意味着可重现和声明性,这意味着只有在所有依赖项都记录在项目的 .cabal 文件中并且项目的 stack.yaml 定义了这些依赖项的版本后,堆栈项目才会编译resolver或部分中的依赖项extra-deps

你的困惑似乎源于对做什么的误解stack install。命令行帮助有这样的说法:

  build                    Build the package(s) in this directory/configuration
  install                  Shortcut for 'build --copy-bins'
...
  --[no-]copy-bins         Enable/disable copying binaries to the local-bin-path
                           (see 'stack path')

stack install保存任何依赖项。

因此,使 hakyll 可用作代码依赖项的正确方法是:

  • stack init如果您已经有 Cabal 包,或者stack new没有,请创建一个适当的堆栈项目。

  • 添加到.cabal 文件中hakyll的库或可执行文件。build-depends

  • 尝试stack build并按照任何错误消息中的说明进行操作,直到所有问题都得到解决。

于 2017-01-21T11:44:45.963 回答
2

在这种情况下,比@sjakobi 更简单的解决方案是在启动新的 Stack 项目时将解析器指定为命令行选项:

stack install hakyll --resolver=5.11 --install-ghc
于 2017-01-21T19:19:06.283 回答