【问题标题】:How do I make the containers package match in stack for the version I want?如何使容器包在堆栈中匹配我想要的版本?
【发布时间】:2017-06-28 03:22:12
【问题描述】:

在我的 cabal 文件中,我有以下构建依赖项:

  build-depends:       base >= 4.7 && < 5,
                       containers >= 0.5.10 && < 0.6

当我尝试运行 stack build 时,出现以下错误:

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

In the dependencies for server-0.1.0.0:
    containers-0.5.7.1 must match >=0.5.10 && <0.6 (latest applicable is 0.5.10.2)

cabal 遇到了这个问题,我使用 cabals 的沙箱解决了这个问题。我不知道如何通过查看--help 文档、错误、堆栈文档和搜索来解决堆栈问题。如果不是通过 cabal 文件,我如何告诉堆栈我想要更新版本的容器?

我还尝试运行stack install containers-0.5.7.1,但没有达到我的预期。我在安装列表中看到了一个容器。我注意到documentation 说堆栈默认是沙盒的,但是由于容器依赖性,构建这个简单的源文件非常痛苦。

我注意到这个命令报告的是旧版本的容器,而不是我想要的版本:

$ stack list-dependencies
array 0.5.1.1
base 4.9.1.0
containers 0.5.7.1
deepseq 1.4.2.0
ghc-prim 0.5.0.0

【问题讨论】:

    标签: haskell dependency-management haskell-stack


    【解决方案1】:

    尝试将以下内容放入stack.yaml

    extra-deps:
    - containers-0.5.10.2
    

    另一种让它发挥作用的方法是改变你的阴谋集团约束。让它像这样应该使它工作:

     build-depends:       base >= 4.7 && < 5,
                          containers >= 0.5.7 && < 0.6
    

    请注意,目前 Stackage 的 lts 中只有 0.5.7.1 可用。

    【讨论】:

    • 谢谢!我运行了 `stack solver --update-config` 并这样做了,现在它构建没有错误。再次感谢您!
    • 我其实更喜欢 0.5.10.2,因为它有我觉得方便的新功能,所以我不想降低版本。
    【解决方案2】:

    除了@Sibi 的出色回答,我发现这个命令会自动解决我的依赖问题:

    stack solver --update-config
    

    【讨论】:

      猜你喜欢
      • 2021-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-21
      相关资源
      最近更新 更多