7

当我尝试通过堆栈安装 ghc-mod 时,我最终遇到了这些依赖冲突

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

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.8 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
    haskell-src-exts-1.20.2 from stack configuration does not match <1.20 && >=1.18  (latest matching version is 1.19.1)
    hlint-2.1.6 from stack configuration does not match <2.1 && >=2.0.8  (latest matching version is 2.0.15)
    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.2.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 different approaches to resolving this:

  * Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build configuration. This can be convenient when dealing with many complicated constraint
    errors, but results may be unpredictable.

  * Recommended action: try adding the following to your extra-deps in /Users/mo/.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
- haskell-src-exts-1.19.1
- hlint-2.0.15
- monad-journal-0.7.2
- optparse-applicative-0.13.2.0

如果我尝试像这样添加建议的额外部门

extra-deps:
- Cabal-1.24.2.0
- base-4.9.1.0
- cabal-helper-0.7.3.0
- extra-1.5.3
- haskell-src-exts-1.19.1
- hlint-2.0.15
- monad-journal-0.7.2
- optparse-applicative-0.13.2.0
- process-1.4.3.0
- either-4.4.1.1
- free-4.12.4

我最终有一个这样的循环

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

In the dependencies for ghc-mod-5.8.0.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)
    ghc-8.2.2 from stack configuration does not match >=7.6 && <8.2
needed since ghc-mod is a build target.

In the dependencies for haskell-src-exts-util-0.2.3:
    haskell-src-exts-1.19.1 from stack configuration does not match >=1.20.0  (latest matching version is 1.20.2)
needed due to ghc-mod-5.8.0.0 -> haskell-src-exts-util-0.2.3

In the dependencies for hlint-2.0.15:
    haskell-src-exts-1.19.1 from stack configuration does not match >=1.20 && <1.21  (latest matching version is 1.20.2)
needed due to ghc-mod-5.8.0.0 -> hlint-2.0.15

Some different approaches to resolving this:

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

  * Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build configuration. This can be convenient when dealing with many complicated constraint
    errors, but results may be unpredictable.

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

- base-4.9.1.0
- haskell-src-exts-1.20.2

如果我把 - haskell-src-exts-1.20.2 他们问我 - haskell-src-exts-1.19.1 回来,反之亦然,我不知道如何处理这个依赖冲突,我也试图运行堆栈解析器,但它没有让我到任何地方

4

3 回答 3

9

问题是 ghc-mod 不支持较新版本的 GHC,我相信最后支持的版本是 GHC 8.0。您可以尝试将 Stack 解析器更改为 lts-8.24 或 nightly-2017-06-28(请参阅ghc-mod 的 Stackage 页面上列出的快照)。

于 2018-06-21T03:15:18.937 回答
4

更简单的是,这对我有用: stack install ghc-mod --resolver lts-8.24

于 2019-01-07T19:56:14.070 回答
-1

输入命令行:

堆栈安装 ghc-mod --resolver lts-8.24

它真的很有帮助。

于 2019-03-05T01:32:50.577 回答