2017-01-21 41 views
3

我试图建立Hakyll上一个新的Ubuntu 16.04的实例,但我似乎无法得到基于堆栈的安装说明的权利。栈不解决依赖正确

开始接触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出现在我的~/.stack/precompiled/x86_64-linux/ghc-8.0.1/1.24.0.0/,这是不明确的,我$PATH,但是那感觉就像一个非常哈克解决方案,我还没有发现任何文档推荐这种方法。

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

+0

我了解,现在栈'的宗旨安装hakyll'是为了得到'hakyll-init'二进制文件。该命令失败,因为'hakyll-4.9.3.0'与您的stack.yaml(可能是'〜/ .stack/global-project/stack.yaml')中设置的解析器不兼容。虽然'hakyll-4.9.3.0'包含在[nightly-2017-01-17](https://www.stackage.org/nightly-2017-01-17)中,所以你可以'stack - 每晚解析 - 2017-01-17安装hakyll'。 [说明]的其余部分(https://jaspervdj.be/hakyll/tutorials/01-installation.html)应该大体写作。 – sjakobi

+0

顺便提一下[提供'--solver'标志](https://github.com/commercialhaskell/stack/issues/2656),这将使安装带有堆栈的可执行文件变得更加容易。 – sjakobi

回答

2

比@ sjakobi在这种情况下,一个简单的办法是开始一个新的Stack项目时指定一个解析器的命令行选项:

stack install hakyll --resolver=5.11 --install-ghc 
3

使用堆栈进行依赖管理是可重复的和声明式的,这意味着只有在所有依赖项都记录在项目的.cabal文件中以及项目的stack.yaml后才会编译堆栈项目在resolverextra-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创建一个适当的堆栈项目,如果你已经有了一个惊天动地包,或者stack new如果你不这样做。

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

  • 尝试stack build并按照任何错误消息的指令,直到所有问题得到解决。

+0

虽然您可以使用'stack install'来安装软件包,但它并不会使已安装的软件包可供项目使用。 – Cubic

+0

@Cubic这取决于你的意思是“安装软件包”。你怎么理解它? – sjakobi

+1

我可以'堆栈安装',该软件包将被下载,构建,我可以使用'stack exec'执行包中的任何二进制文件...如果有另一种解释“安装包“我不知道。 – Cubic