stack.yaml 没有依赖 github

stack.yaml not pulling in dependency from github

这是 stack.yaml 节

包:

- location:
   git: https://github.com/TwitterFriends/lsh.git
   commit: 57d57f4209e56f526c0eca023907015935c26071
   extra-dep: true

我将包添加到 cabal 文件

尝试构建时出现错误

While constructing the BuildPlan the following exceptions were encountered:

--  While attempting to add dependency,
    Could not find package lsh in known packages

我做错了什么?

在此处找到当前项目

https://github.com/TwitterFriends/twitter-friend-server

语法问题。您在 extra-dep 之前添加了一些额外的空格。将其放在 stack.yaml 中。这样,您的项目就可以在我的机器上构建了。

- location:
    git: https://github.com/TwitterFriends/lsh.git
    commit: 57d57f4209e56f526c0eca023907015935c26071
  extra-dep: true

更新: (2017 年 12 月 17 日)

因为 stack-1.6.1 添加 github 依赖项的语法已更改。您需要将 github 依赖项添加到 extra-deps 字段中。像这样:

resolver: lts-9.17
packages: [.]

extra-deps:
- fmt-0.5.0.0
- git: https://github.com/TwitterFriends/lsh.git
  commit: 57d57f4209e56f526c0eca023907015935c26071

更新: (2019 年 12 月 5 日)

stack-2.1.3 中,您可以在 extra-deps 中指定 GitHub 依赖项,语法甚至更短:

extra-deps:
- github: TwitterFriends/lsh
  commit: 57d57f4209e56f526c0eca023907015935c26071

您遇到的问题似乎是由于 stack.yaml 文件中您在问题中发布的那些行之前的行存在语法错误。

当我访问您的存储库并查看整个 stack.yaml 文件时,我看到了这个:

resolver: lts-8.13

# User packages to be built.
# Various formats can be used as shown in the example below.
# 
packages:

# - https://example.com/foo/bar/baz-0.0.2.tar.gz
- location:
    git: https://github.com/TwitterFriends/lsh.git
    commit: 57d57f4209e56f526c0eca023907015935c26071
  extra-dep: true

packages: 行看起来不正确,尤其是考虑到文件后面的内容:

packages:
- '.'

所以我最好的猜测是 stack.yaml 文件没有被正确解析,所以它找不到库 b/c 它不知道应该从中获取它位置。