haskell - 无法安装 GHC-Mod
问题描述
大家好,我正在尝试为 vscode 安装 ghc-mod,我遇到了这个问题:
**$ stack install ghc-mod**
Populated index cache.
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)
mcabal-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 C:\sr\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
Plan construction failed.
我试过stack install ghc-mod
但cabal install ghc-mod
无济于事。我总是得到这个plan construction failed
。关于如何处理它的任何想法?
PS:我已经更新了堆栈和阴谋集团。
在听从用户的建议后,我将文件添加到了C:\sr\global-project/stack.yaml
,现在它看起来像这样:
全球 stack.yaml
:
packages: []
resolver: lts-11.13
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
添加所有这些文件后,运行时出现以下错误stack install ghc-mod
:
$ stack install ghc-mod
Unable to load custom resolver lts-11.13 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 from local file:
C:\sr\global-project\lts-11.13 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
Exception: InvalidYaml (Just (YamlException "Yaml file not found: C:\\sr\\global-project\\lts-11.13 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"))
解决方案
问题是它ghc-mod
不适用于 ghc-8.2。支持的最新 Stack 解析器ghc-mod
似乎是lts-9.21
.
ghc-mod
必须使用与您使用的相同版本的 GHC 进行编译,因此现在将您限制为 8.0。
编辑(2020 年 8 月): ghc-mod 已被弃用,取而代之的是Haskell IDE 引擎(HIE)。
推荐阅读
- java - 流过滤器返回 null findFirst 获取异常
- python - Pycharm中的Scrapy,导入其他文件问题
- python-3.x - 如何使用 brew install 中的 python3.7 运行?
- reactjs - 如果我添加 if 语句,React setState 不会更新
- android - 如何将多张图片转换为一个pdf文件
- c++ - 使RDF可读,转换成XML
- javascript - p-listbox: [filter]="true" 不过滤列表中的第一个元素
- ios - 为什么这个图片链接没有出现在 ios 的 UIimageView 中?
- arrays - 我怎样才能在swift中编写char类型矩阵
- reactjs - 如何在没有延迟的情况下一次调用客户端获取 10,000 条数据?