I'm trying to use intero-mode in a stack project that has the docker integration enabled. Therefore its stack.yml contains:
docker:
enable: true
image: my-project/build:lts-11.9
Even though, when I open any .hs file in the project, intero-mode tries to install the intero executable and fails. In the Messages buffer it reports:
Installed successfully! Starting Intero in a moment ...
Booting up intero ...
Problem with Intero!
Reading Haskell configuration failed with exit code 1 and output:
get-cabal-configuration.hs: /home/jesuspc/.nix-profile/bin/hpack: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
And I get the error screen for intero-mode:
...
The process ended. Here is the reason that Emacs gives us:
exited abnormally with code 1
For troubleshooting purposes, here are the arguments used to launch intero:
stack ghci --with-ghc /home/jesuspc/.stack/compiler-tools/x86_64-linux-dke094d5208e8a802cb369cecdad3049ae/ghc-8.2.2/bin/intero "--docker-run-args=--interactive=true --tty=false" --no-build --no-load --ghci-options -ignore-dot-ghci my-project
...
When I run that line I get:
Did not find executable at specified path: /home/jesuspc/.stack/compiler-tools/x86_64-linux-dke094d5208e8a802cb369cecdad3049ae/ghc-8.2.2/bin/intero
Which may be something related to nix, because I found that by running instead:
stack ghci --with-ghc /home/jesuspc/.stack/compiler-tools/x86_64-linux-nix/ghc-8.2.2/bin/intero "--docker-run-args=--interactive=true --tty=false" --no-build --no-load --ghci-options -ignore-dot-ghci my-project
I get a different error:
/home/jesuspc/.stack/compiler-tools/x86_64-linux-nix/ghc-8.2.2/bin/intero: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
I believe that this error may be thrown because my project uses external libraries and it can not find them, but that's just a guess.
Is intero-mode even aware of the stack-docker integration? It seems to be trying to use the intero executable in my local machine instead of using the docker context, where all the required libraries are present. How can I fix it?
I just came across this issue yesterday as well. It looks like the issue is in the function intero-copy-compiler-tool-auto-install
which does not take into account your stack.yaml
file and so does not build intero
into the docker container. A super hacky work around I found is to run
stack --docker build --copy-compiler-tool intero
from within your project.