stack.yaml没有从github拉入依赖

问题描述 投票:1回答:2

这是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

haskell haskell-stack
2个回答
3
投票

问题是语法。你在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

1
投票

看起来您遇到的问题是由于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它不知道它应该从那个位置抓取它。

© www.soinside.com 2019 - 2024. All rights reserved.