繁体   English   中英

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 日)

由于添加 github 依赖项的stack-1.6.1语法已更改。 您需要将您的 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文件中的行中的语法错误直接位于您在问题中发布的行之前。

当我访问你的 repo 并查看整个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 它不知道它应该从那个位置获取它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM