堆栈未正确解析依赖项
Stack not resolving dependencies properly
我正在尝试在新的 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)后,我再次尝试 stack install http-conduit-2.1.11
,但我再次遇到相同的依赖关系错误。
包 http-client-0.4.31.2
和 http-client-tls-0.2.4.1
出现在我的 ~/.stack/precompiled/x86_64-linux/ghc-8.0.1/1.24.0.0/
中,这在我的 $PATH
中没有明确显示,但是这感觉像是一个非常 hacky 的解决方案,并且我还没有找到任何推荐这种方法的文档。
如何在我的机器上正确安装 Hakyll?
使用堆栈的依赖管理意味着可重现和声明,这意味着堆栈项目只会在所有依赖项都记录在项目的 .cabal 文件中并且一旦 stack.yaml项目的 resolver
or the 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 作为代码的依赖项可用的正确方法是:
如果您已经有 Cabal 包,请使用 stack init
创建一个合适的堆栈项目,如果没有,请使用 stack new
。
将 hakyll
添加到您的 .cabal 文件中的库或可执行文件 build-depends
。
尝试 stack build
并按照任何错误消息中的说明进行操作,直到所有问题都得到解决。
在这种情况下,比@sjakobi 更简单的解决方案是在启动新 Stack 项目时将解析器指定为命令行选项:
stack install hakyll --resolver=5.11 --install-ghc
我正在尝试在新的 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)后,我再次尝试 stack install http-conduit-2.1.11
,但我再次遇到相同的依赖关系错误。
包 http-client-0.4.31.2
和 http-client-tls-0.2.4.1
出现在我的 ~/.stack/precompiled/x86_64-linux/ghc-8.0.1/1.24.0.0/
中,这在我的 $PATH
中没有明确显示,但是这感觉像是一个非常 hacky 的解决方案,并且我还没有找到任何推荐这种方法的文档。
如何在我的机器上正确安装 Hakyll?
使用堆栈的依赖管理意味着可重现和声明,这意味着堆栈项目只会在所有依赖项都记录在项目的 .cabal 文件中并且一旦 stack.yaml项目的 resolver
or the 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 作为代码的依赖项可用的正确方法是:
如果您已经有 Cabal 包,请使用
stack init
创建一个合适的堆栈项目,如果没有,请使用stack new
。将
hakyll
添加到您的 .cabal 文件中的库或可执行文件build-depends
。尝试
stack build
并按照任何错误消息中的说明进行操作,直到所有问题都得到解决。
在这种情况下,比@sjakobi 更简单的解决方案是在启动新 Stack 项目时将解析器指定为命令行选项:
stack install hakyll --resolver=5.11 --install-ghc