Stack: Starting a new project fails to build

Created on 23 Jan 2019  路  6Comments  路  Source: commercialhaskell/stack

When following the directions in (start-your-new-project)[https://docs.haskellstack.org/en/stable/README/#start-your-new-project] there are some errors I cannot decipher and can't find any helpful resolutions.

During stack build the following error occurs, but I don't know what it means:

Error parsing targets: The specified targets matched no packages.

Any help getting past this would be much appreciated. I can re-open on stack overflow if that would be better.

I've run stack update and stack upgrade, and should be on the latest everything.

Am I missing something??

Reproduce

$ stack new state-machine-testing
Downloading template "new-template" to create project "state-machine-testing" in state-machine-testing/ ...

The following parameters were needed by the template but not provided: author-email, category, copyright
You can provide them in /Users/huck/.stack/config.yaml, like this:
templates:
  params:
    author-email: value
    category: value
    copyright: value
Or you can pass each one as parameters like this:
stack new state-machine-testing new-template -p "author-email:value" -p "category:value" -p "copyright:value"

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- state-machine-testing/

Selecting the best among 15 snapshots...

Didn't see GLFW-b-3.2.1.0@sha256:cb626762f730e8440ec2ac7628c5790685a8ea9e931037021b63b781c8f18b76,2363 in your package indices.
Updating and trying again.
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/               Downloading timestamp                                                          No updates to your package index were found                                    Update complete                                                                Unable to load cabal files for snapshot

----
Deleting cached snapshot file: /Users/huck/.stack/build-plan/lts-13.4.yaml
Recommendation: try running again. If this fails again, open an upstream issue at:
https://github.com/fpco/lts-haskell/issues/new
----

The following package identifiers were not found in your indices: GLFW-b-3.2.1.0@sha256:cb626762f730e8440ec2ac7628c5790685a8ea9e931037021b63b781c8f18b76,2363
The specified revision was not found.
Possible candidates: GLFW-b-3.2.1.0@sha256:8970a1ef2459db7939f5195c6e8aabd67c957692597d99397ff8c6d5c4bcb459.

cd to project directory

cd state-machine-testing/

Run stack setup

$ stack setup
stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec

Running stack build shows the following error

$ stack build
Error parsing targets: The specified targets matched no packages.
Perhaps you need to run 'stack init'?

Running stack exec

$ stack exec state-machine-testing-exe
Executable named state-machine-testing-exe not found on path: .....<PATH INFO>

Stack version

$ stack --version
Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1

System information

Mac Sierra 10.13.6

Method of installation

curl -sSL https://get.haskellstack.org/ | sh -f
build os x / macos bug question

Most helpful comment

Yes, I can now build new projects consistently (3 successful attempts).

Thank you very much for the help.

All 6 comments

Can you post the output of

stack new state-machine-testing --resolver=nightly

@mihaimaruseac

I just ran stack new again without the nightly flag, and instead of the
No updates to your package index were found message, I got Downloading snapshot with a couple other messages.

I then tried the same with a new project name and included the nightly flag, then ran stack setup and its now downloading GHC 8.6.3.

So it looks like something changed, or running nightly helped.

EDIT: Once the new GHC was installed, I ran setup and build on both the non-nightly and nightly and they BOTH ran and built correctly.

Here's the output of the two stack new tests.

$ stack new state-machine-testing2
Downloading template "new-template" to create project "state-machine-testing2" in state-machine-testing2/ ...

The following parameters were needed by the template but not provided: author-email, category, copyright
You can provide them in /Users/huck/.stack/config.yaml, like this:
templates:
  params:
    author-email: value
    category: value
    copyright: value
Or you can pass each one as parameters like this:
stack new state-machine-testing2 new-template -p "author-email:value" -p "category:value" -p "copyright:value"

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- state-machine-testing2/

Selecting the best among 15 snapshots...

Didn't see GLFW-b-3.2.1.0@sha256:cb626762f730e8440ec2ac7628c5790685a8ea9e931037021b63b781c8f18b76,2363 in your package indices.
Updating and trying again.
Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/               Downloading timestamp                                                          Downloading snapshot                                                           Updating index                                                                 Updated package index downloaded                                               Update complete                                                                Populated index cache.    
* Matches lts-13.4

Selected resolver: lts-13.4
Initialising configuration using resolver: lts-13.4
Total number of user packages considered: 1
Writing configuration to file: state-machine-testing2/stack.yaml
All done.
$ stack new state-machine-testing3 --resolver=nightly
Downloading template "new-template" to create project "state-machine-testing3" in state-machine-testing3/ ...

The following parameters were needed by the template but not provided: author-email, category, copyright
You can provide them in /Users/huck/.stack/config.yaml, like this:
templates:
  params:
    author-email: value
    category: value
    copyright: value
Or you can pass each one as parameters like this:
stack new state-machine-testing3 new-template -p "author-email:value" -p "category:value" -p "copyright:value"

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- state-machine-testing3/

Selected resolver: nightly-2019-01-23
Downloaded nightly-2019-01-23 build plan.    
Selected resolver: nightly-2019-01-23
Initialising configuration using resolver: nightly-2019-01-23
Total number of user packages considered: 1
Writing configuration to file: state-machine-testing3/stack.yaml
All done.

So it seems that now you can build the new projects. Can you verify that this is the case?

I think you were in an inconsistent snapshot state before and a package has not been updated to the version in the snapshot. By the time you ran the new commands this got self-fixed.

Yes, I can now build new projects consistently (3 successful attempts).

Thank you very much for the help.

I'm getting this same issue when trying to build a dockerfile.

Dockerfile is:

```FROM ubuntu:bionic

RUN apt-get update && apt-get -y upgrade

RUN apt-get install -y curl wget libgmp-dev libbz2-dev libreadline-dev software-properties-common locales-all locales libsecp256k1-dev

RUN apt-get update

RUN wget https://github.com/ethereum/solidity/releases/download/v0.4.25/solc-static-linux

RUN chmod +x solc-static-linux

RUN mv solc-static-linux /usr/bin/solc

RUN curl -sSL https://get.haskellstack.org/ | sh

COPY . /echidna/

WORKDIR /echidna

RUN stack --version

RUN stack upgrade && stack setup && stack install

ENV PATH=$PATH:/root/.local/bin

RUN update-locale LANG=en_US.UTF-8

RUN locale-gen en_US.UTF-8

ENV LANG en_US.UTF-8

ENV LANGUAGE en_US:en

ENV LC_ALL en_US.UTF-8

CMD ["/bin/bash"]```

Hi @AndyWatt83. This looks like a separate issue, would you like to open a new issue please? Posting the error message too and any other details that might help us in debugging this fast? Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

symbiont-joseph-kachmar picture symbiont-joseph-kachmar  路  3Comments

s5k6 picture s5k6  路  3Comments

jwaldmann picture jwaldmann  路  4Comments

mgsloan picture mgsloan  路  3Comments

Toxaris picture Toxaris  路  4Comments