stack install error: Recommended extra-dep

stack install error: Recommended extra-dep

我目前正在尝试安装堆栈以使用太极软件。我已经能够 运行 'stack setup',但是当我 运行 堆栈安装时出现错误:

C:\Users\My Name\Taiji-1.2.1>stack install

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for shelly-1.8.1:
    unix needed, but the stack configuration has no specified version  (latest matching version is 2.7.2.2)
needed due to Taiji-1.2.1 -> shelly-1.8.1

Some different approaches to resolving this:

  * Recommended action: try adding the following to your extra-deps in C:\Users\My Name\Taiji-1.2.1\stack.yaml:

- unix-2.7.2.2@sha256:9e93f93cc5a065248120136e83a0a6d1ce93d6eb5ef2a2543f9593e93e164d24,3496

Plan construction failed.

我猜我必须安装另一个软件包并将其放入 Taiji-1.2.1 文件夹,但不确定如何(我是 stack/programming 的新手)。有人能帮我解决这个问题吗?谢谢。

当您看到此错误时,您需要打开 stack.yaml(错误消息包含完整路径),找到显示 # extra-deps: [] 的行,并将其替换为如下所示的行错误信息:

extra-deps:
- unix-2.7.2.2@sha256:9e93f93cc5a065248120136e83a0a6d1ce93d6eb5ef2a2543f9593e93e164d24,3496

(如果您已经在 extra-deps 中列出了一些内容,那么您可以将该行添加到 extra-deps 的末尾,而不是替换整个内容。)

现在,这通常就足够了。但是你还有一个问题:你正在使用 Windows,但你正在尝试编译一个依赖于 unix 包的程序——一个在 Windows 上不可用的包.因此,您将无法在 Windows.

上编译您的程序

(至于 为什么 需要所有 extra-deps 的东西:基本上,Stack 维护着一个已知可以相互协作的包版本列表,但偶尔你会运行 放入不在该列表中的包。在这种情况下,您需要在 extra-deps 中列出该包版本以告诉 Stack 使用哪个版本。)