首页 > 解决方案 > 当指定超出依赖项的版本范围的额外dep时,堆栈无法在快照中找到包

问题描述

我有一个package.yaml包含

dependencies:
- aeson >= 0.8 && < 1.5
- base >= 4.7 && < 5
- time >= 1.5 && < 1.10

我想使用timelts-14.4快照中更新的版本,所以我创建了一个stack.yaml

resolver: lts-14.4
packages:
- .
extra-deps:
- time-1.9.2

但是,当我运行时stack build,我得到了输出

WARNING: Ignoring aeson's bounds on time (>=1.4 && <1.9); using time-1.9.2.
Reason: trusting snapshot over cabal file dependency information.

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

In the dependencies for base-compat-0.10.5:
    unix needed, but the stack configuration has no specified version  (latest matching version is 2.7.2.2)
needed due to tmphaskell-0.1.0.0 -> base-compat-0.10.5

Some different approaches to resolving this:

  * Recommended action: try adding the following to your extra-deps in /Users/will/src/tmphaskell/stack.yaml:

- unix-2.7.2.2@sha256:e69269a17b9fa26cb77f3f55e86c39d0a4940ccfa0c4bc20826919d2572076ad,3496

Plan construction failed.

unix-2.7.2.2 快照中确实存在我对此不了解的内容,lts-14.4那么为什么无法堆栈找到指定的版本?

在我将它升级到2.1.3. 我不确定我之前运行的是哪个版本。

标签: haskellhaskell-stack

解决方案


aeson(via base-compat) 依赖于unixand astime并且unix是 ghc 引导包,两者都需要添加 as extra-deps

原因?引导库不必匹配它们的 hackage 版本,因此如果您覆盖引导包,您还必须明确覆盖您使用的任何其他包。

来源:https ://www.snoyman.com/blog/2019/01/mismatched-global-packages

(编辑固定错误;误读精确错误)。


推荐阅读