Stack: "Cannot determine project root directory for Docker sandbox." error even when Docker support is disabled

Created on 14 Jun 2019  ยท  11Comments  ยท  Source: commercialhaskell/stack

General summary/comments (optional)

Stack produces a docker-related error when trying to create a new project

โฏ stack new lol
Cannot determine project root directory for Docker sandbox.

Steps to reproduce

  1. Configure `config.yaml to explicitly disable Docker:
docker:
  enable: false
  1. Run stack new <name>

  2. Weep.

Stack version

โฏ Version 2.1.1, Git revision f612ea85316bbc327a64e4ad8d9f0b150dc12d4b (7648 commits) x86_64 hpack-0.31.2

Method of installation

  • stack upgrade from the latest version

How to resolve this

  1. Removing ~/.stack and /usr/local/bin/stack
  2. Reinstall Stack

Does it solve it entirely?

No. It comes back after a while.

Most helpful comment

That sounds like some odd bug to me :)
Some moths ago it was decided that there is no sense to use nix and docker modes of Stack simultaneously - probably we've added some improper config handling with that change. I hope to have time check it out later in the day.

All 11 comments

@borsboom Hi! Do you have any idea about what is happening here?

Hello, thanks for reporting. Would you share some project information (e.g. stack.yaml, package.yaml/cabal files)? Also, precisely which config.yaml do you mean?

Hi @dbaynard!
The config.yaml I was talking about was ~/.stack/config.yaml.


stack.yaml

nix:
  enable: true
  pure: false
  packages: [glpk, pcre, curl, zlib]

docker:
  enable: false

I am unable to give you the content of any package.yaml / cabal, because they cannot be generated due to the aforementioned error.

I am indeed running this command (but any other, actually) from my home directory.

A couple of questions:

  • Does this happen if you remove the docker section (but keep the nix section)?
  • Alternatively, what happens if you remove the nix section but keep the docker section?
  • And finally, what happens if you remove both?

I suspect the mention of Docker in the error message is a red herring, because the Nix code was initially based on the Docker code and it looks like it re-uses this error message.

Hi @borsboom!

  • When the docker section is removed but the nix section is kept, it still doesn't work :disappointed:;
  • When thenix section is removed, it works :tada:;
  • When both sections are removed, it works :tada:.

@Kleidukos but I guess 2nd and 3rd options disable nix integration - are you OK with disabling it?
What OS are you on?

@qrilka I enabled it at the project level, and it works :/ I don't understand why it would fail at the global level and not at the project level, but it seems to be working :woman_shrugging:

Edit: I'm running Fedora 30

That sounds like some odd bug to me :)
Some moths ago it was decided that there is no sense to use nix and docker modes of Stack simultaneously - probably we've added some improper config handling with that change. I hope to have time check it out later in the day.

I guess 2nd and 3rd options disable nix integration - are you OK with disabling it?

For what it's worth, NixOS users can't use Stack and disable Nix integration, so this effectively makes certain commands unusable there.

@ttuegel that's not quite correct: nix mode is the default but it's not 100% required but you need to supply GHC by some other way (Nix seems to be the most obvious choice in this case) as an example see https://gist.github.com/qrilka/2b21576e541412656bde0c4ca6c2064e

@Kleidukos there was a Stack bug in stack.yaml being required for any commands in Nix mode which resulted in that misleading error message about Docker, #4885 fixed that

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Cosmius picture Cosmius  ยท  3Comments

sjakobi picture sjakobi  ยท  3Comments

fizruk picture fizruk  ยท  3Comments

mgsloan picture mgsloan  ยท  3Comments

sjakobi picture sjakobi  ยท  4Comments