如何在WSL上运行stack ghci?

3

我在 Windows 子系统 Ubuntu 20.04.3 LTS 上安装了 Haskell 的 stack。 使用命令 curl -sSL https://get.haskellstack.org/ | sh 成功安装了 stack。

但是,当我尝试运行 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标志并没有帮助,因为它再次显示了相同的错误。 我在Google上没有找到任何有用的信息。


1
你所做的应该是可行的,在我的WSL上也可以工作。你尝试过删除/home/et/.stack并重新开始吗?以防它是一些突发情况,留下了一个损坏的目录。 - amalloy
1
你正在使用WSL 1还是WSL 2? - Joseph Sible-Reinstate Monica
感谢您提供的建议。我发现我正在使用WSL 1。 `PS C:\WINDOWS\system32> wsl -l -v NAME STATE VERSION
  • Ubuntu-20.04 Stopped 1` 我将升级到版本2,看看是否有帮助。
- Evgeniy Tishin
1个回答

1

我按照WSL | Ubuntu的说明安装了WSL 2,然后成功地安装了stack ghci。感谢Joseph提供的建议。


你的回答可以通过提供更多支持信息来改进。请编辑以添加进一步的细节,例如引用或文档,以便他人可以确认你的答案是正确的。您可以在帮助中心找到有关如何编写良好答案的更多信息。 - Community

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接