在构建构建计划时,遇到了以下异常

While constructing the build plan, the following exceptions were encountered

我正在尝试安装

stack install ghc-mod

我遇到了以下错误:

In the dependencies for ghc-mod-5.8.0.0:
    Cabal-2.0.1.1 from stack configuration does not match >=1.18 && <1.25 (latest matching version is 1.24.2.0)
    base-4.10.1.0 from stack configuration does not match >=4.6.0.1 && <4.10 (latest matching version is 4.9.1.0)
    cabal-helper must match <0.8 && >=0.7.3.0, but the stack configuration has no specified version (latest matching version is 0.7.3.0)
    extra-1.6.2 from stack configuration does not match <1.6 && >=1.4 (latest matching version is 1.5.3)
    ghc-8.2.2 from stack configuration does not match >=7.6 && <8.2
    monad-journal-0.8.1 from stack configuration does not match <0.8 && >=0.4 (latest matching version is 0.7.2)
    optparse-applicative-0.14.0.0 from stack configuration does not match >=0.13.0.0 && <0.14 (latest matching version is 0.13.2.0)
needed since ghc-mod is a build target.

Some potential ways to resolve this:

  * Recommended action: try adding the following to your extra-deps in /home/developer/.stack/global-project/stack.yaml:

- Cabal-1.24.2.0
- base-4.9.1.0
- cabal-helper-0.7.3.0
- extra-1.5.3
- monad-journal-0.7.2
- optparse-applicative-0.13.2.0

  * Set 'allow-newer: true' to ignore all version constraints and build anyway.

  * You may also want to try using the 'stack solver' command.

Plan construction failed.

我正在使用

~/.local/bin$ stack --version
Version 1.6.3, Git revision b27e629b8c4ce369e3b8273f04db193b060000db (5454 commits) x86_64 hpack-0.20.0

和 ghc 版本 8.2.2。如何绕过错误?

您的 stackage 版本没有那个包 https://www.stackage.org/lts-10.4/hoogle?q=ghc-mod . The old one has it https://www.stackage.org/lts-8.23/hoogle?q=ghc-mod。我猜包被认为是无人维护的,因为它最后一次更新是在 2017 年 7 月。

您可以阅读有关如何从 hackage 添加任何包的官方文档,特别是外部依赖部分 https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md#external-dependencies

但是,最新的 Haskell 版本可能会出现问题。

对于 lts-10.4,您可以使用最底部提到的 here 解决方法: 在 extra-deps 下的 stack.yaml 中安装 ghc-mod-5.9.0.0 和一些更多软件包的候选版本。然后做一个

stack build ghc-mod
stack install ghc-mod

大功告成。 ghc-8.2.2下至少"works for me":

ghc-mod --version

$> ghc-mod version 5.9.0.0 compiled by GHC 8.2.2

我在使用 atom 时还没有遇到任何问题。 希望这有帮助。