haskell 使用 stack install happy 时堆栈全局 ghc 版本不匹配

haskell stack global ghc version not match when use stack install happy

我已遵循此命令:

检查 PATH 上的 ghc

root@9a79ab5e17cb:~# ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.10.3

设置栈全局ghc版本

root@9a79ab5e17cb:~# stack setup 7.10.3
stack will use the GHC on your PATH
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec

设置堆栈全局解析器后:

cat /root/.stack/global-project/stack.yaml  
flags: {}
extra-package-dbs: []
packages: []
extra-deps: []
resolver: lts-7.10

安装快乐失败>.<

root@9a79ab5e17cb:~# stack install happy
Run from outside a project, using implicit global project config
Using resolver: lts-7.10 from implicit global project's config file: /root/.stack/global-project/stack.yaml
Compiler version mismatched, found ghc-7.10.3 (x86_64), but expected minor version match with ghc-8.0.1 (x86_64) (based on resolver setting in /root/.stack/global-project/stack.yaml).
Try running "stack setup" to install the correct GHC into /root/.stack/programs/x86_64-linux/

如何更改堆栈 ghc 全局版本?

错误消息告诉您您正在使用 GHC 7.10.3,但 lts-7.10 适用于 GHC 8.0.1。您可以执行以下两项操作之一:

  • 保留 GHC 7.10.3 并将您的左轮手枪更改为 lts-6.26(截至 2016 年 12 月 2 日最新的 7.10.3 解析器)
  • 按照它的建议去做 运行 stack setup。这将自动安装 GHC 8.0.1,因为这是您的解析器所期望的。