Reputation:
Here's the stack.yaml stanza
packages:
- location:
git: https://github.com/TwitterFriends/lsh.git
commit: 57d57f4209e56f526c0eca023907015935c26071
extra-dep: true
I add the package to cabal file
get error when I try to build
While constructing the BuildPlan the following exceptions were encountered:
-- While attempting to add dependency,
Could not find package lsh in known packages
What am I doing wrong?
Current project found here
https://github.com/TwitterFriends/twitter-friend-server
Upvotes: 3
Views: 866
Reputation: 9179
The problem is syntax. You added some extra spaces before extra-dep
. Place this in stack.yaml
. With this, your project builds on my machine.
- location:
git: https://github.com/TwitterFriends/lsh.git
commit: 57d57f4209e56f526c0eca023907015935c26071
extra-dep: true
UPDATE: (17 Dec 2017)
Since stack-1.6.1
syntax of adding github dependency is changed. You need to add your github dependency into extra-deps
field. Something like this:
resolver: lts-9.17
packages: [.]
extra-deps:
- fmt-0.5.0.0
- git: https://github.com/TwitterFriends/lsh.git
commit: 57d57f4209e56f526c0eca023907015935c26071
UPDATE: (5 Dec 2019)
In stack-2.1.3
you can specify GitHub dependencies in extra-deps
with even shorter syntax:
extra-deps:
- github: TwitterFriends/lsh
commit: 57d57f4209e56f526c0eca023907015935c26071
Upvotes: 4
Reputation: 1253
It looks like the problem you're facing is due to a syntax error in the lines in your stack.yaml
file directly preceding those you posted in the question.
When I visited your repo and checked out the whole stack.yaml
file, I saw this:
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
This packages:
line doesn't look right, especially given that later in the file you have:
packages:
- '.'
So my best guess would be that the stack.yaml
file isn't getting parsed correctly, so it can't find the library b/c it doesn't know it should grab it from that location.
Upvotes: 1