问题
When I try to install ghc-mod via stack I end up having these depencies conflicts
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
if I try to add the suggested extra deps like so
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
I end up having a loop like this
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
if i put - haskell-src-exts-1.20.2 they ask me for - haskell-src-exts-1.19.1 back and vice versa I can't figure out what to do about this dependency conflict, and also I tried to run stack resolver but it doesn't get me anywhere
回答1:
The issue is that ghc-mod does not support newer versions of GHC, I believe the last supported version is GHC 8.0. You can try changing your Stack resolver to lts-8.24 or nightly-2017-06-28 (see the snapshots listed on ghc-mod's Stackage page).
回答2:
Even easier, this worked for me:
stack install ghc-mod --resolver lts-8.24
回答3:
input command line:
stack install ghc-mod --resolver lts-8.24
it really helps.
来源:https://stackoverflow.com/questions/50948485/stack-install-ghc-mod-fails-with-dependencies-conflicts-on-osx-10-13-4