【问题标题】:How to run stack ghci on WSL?如何在 WSL 上运行堆栈 ghci?
【发布时间】:2021-12-23 12:42:54
【问题描述】:

我在 WSL 中安装了 Haskell 堆栈(Windows 10 上的 Ubuntu 20.04.3 LTS)。 之后,我使用命令curl -sSL https://get.haskellstack.org/ | sh成功安装了堆栈

但是,在我尝试运行 gchi 后,我得到了这个错误:

et@DESKTOP-D0DE6C4:~$ stack ghci
Writing implicit global project config file to: /home/et/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-18.16
Preparing to install GHC (tinfo6) to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-tinfo6-8.10.7.
ghc-pkg: Couldn't open database /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/package.conf.d for modification: {handle: /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/package.conf.d/package.cache.lock}: hLock: invalid argument (Invalid argument)
make[1]: *** [ghc.mk:985: install_packages] Error 1
make: *** [Makefile:51: install] Error 2
Received ExitFailure 2 when running
Raw command: /usr/bin/make install
Run from: /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7.temp/ghc-8.10.7/


Error: Error encountered while installing GHC with
         make install
         run in /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7.temp/ghc-8.10.7/

       The following directories may now contain files, but won't be used by stack:
         - /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7.temp/
         - /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/

       For more information consider rerunning with --verbose flag

Installing GHC ...
et@DESKTOP-D0DE6C4:~$

--verbose 标志没有帮助,因为它再次显示相同的错误。 我没能在谷歌上找到任何有用的东西。

【问题讨论】:

  • 你所做的应该工作,并且在 WSL 上为我工作。您是否尝试过删除 /home/et/.stack 并重新开始,以防曾经发生过一些小问题并留下损坏的目录?
  • 你在 WSL 1 还是 WSL 2 上?
  • 感谢您提供的建议。我发现我在 WSL 1 上。PS C:\WINDOWS\system32> wsl -l -v NAME STATE VERSION * Ubuntu-20.04 Stopped 1 我会升级到版本 2 看看它是否有帮助。

标签: haskell windows-subsystem-for-linux haskell-stack


【解决方案1】:

我按照此处WSL | Ubuntu 的说明安装了 WSL 2,之后我成功安装了堆栈 ghci。感谢Joseph 的想法。

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-02-17
  • 1970-01-01
  • 1970-01-01
  • 2018-07-31
  • 1970-01-01
  • 1970-01-01
  • 2011-03-06
相关资源
最近更新 更多