Repository navigation
Description
I get the following issue when attempting to open a Haskell project folder in VS Code on Mac OS X 10.14:
2018-12-12 10:24:12.024134 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Info - 10:24:12 AM] Connection to server got closed. Server will restart.
2018-12-12 10:24:12.066354 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Info - 10:24:12 AM] Connection to server got closed. Server will restart.
2018-12-12 10:24:12.100128 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Info - 10:24:12 AM] Connection to server got closed. Server will restart.
2018-12-12 10:24:12.135374 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Info - 10:24:12 AM] Connection to server got closed. Server will restart.
2018-12-12 10:24:12.169213 [ThreadId 4] - Using plain GHC version
/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --numeric-version (exit 127): failed
[Error - 10:24:12 AM] Connection to server got closed. Server will not be restarted.
The project was created using stack new and can build successfully with stack build.
I do not get a similar issue when I run hie in the workspace (hie is on my $PATH):
2018-12-12 10:26:00.863747 [ThreadId 4] - Using stack GHC version
2018-12-12 10:26:01.439648 [ThreadId 4] - Run entered for HIE(hie) Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2
2018-12-12 10:26:01.447437 [ThreadId 4] - Current directory:/Users/ianbrault/code/haskell/io
nor attempting to run with hie-wrapper (also on my $PATH):
2018-12-12 10:26:59.152784 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2
2018-12-12 10:26:59.164961 [ThreadId 4] - Current directory:/Users/ianbrault/code/haskell/io
2018-12-12 10:27:00.31076 [ThreadId 4] - Cradle directory:/Users/ianbrault/code/haskell/io
2018-12-12 10:27:00.311226 [ThreadId 4] - Using stack GHC version
2018-12-12 10:27:00.488775 [ThreadId 4] - Project GHC version:8.6.2
2018-12-12 10:27:00.489596 [ThreadId 4] - hie exe candidates :["hie-8.6.2","hie-8.6","hie"]
2018-12-12 10:27:00.490847 [ThreadId 4] - found hie exe at:/usr/local/bin/hie-8.6.2
2018-12-12 10:27:00.491539 [ThreadId 4] - args:[]
2018-12-12 10:27:00.491991 [ThreadId 4] - launching ....
2018-12-12 10:27:00.751399 [ThreadId 4] - Using stack GHC version
2018-12-12 10:27:00.949176 [ThreadId 4] - Run entered for HIE(hie-8.6.2) Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2
2018-12-12 10:27:00.96506 [ThreadId 4] - Current directory:/Users/ianbrault/code/haskell/io
Versions of all tools:
- ghc:
The Glorious Glasgow Haskell Compilation System, version 8.6.2 - stack:
Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1 - hie:
Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2 - hie-wrapper:
Version 0.4.0.1, Git revision df6da6308fb5de672ad82ed5cb4dfeb91050d052 (dirty) (2218 commits) x86_64 ghc-8.6.2 - note: the HIE scripts were downloaded from the pre-built Mac binaries provided by the latest release
This is my $PATH: /Users/ianbrault/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/ianbrault/.local/bin:/usr/local/texlive/2017/bin/x86_64-darwin:/Library/TeX/texbin, all of the above binaries are installed in /usr/local/bin
I have seen several other issues where the users get a similar /bin/sh: ghc: command not found error message but I have attempted all the suggested fixes in those issues and have not been able to resolve the problem, specifically:
- setting
languageServerHaskell.hieExecutablePathto point directly at thehiebinary - setting
languageServerHaskell.useCustomHieWrapperto true and settinglanguageServerHaskell.useCustomHieWrapperPathto point directly at thehie-wrapperbinary - symlinking
hie-wrapperto be thehiebinary - running
stack updateandstack upgrade - I have also tried setting the resolver to specifically target
ghc-8.6.2but still get the same errors
Please let me know if there's any more information that would be useful! Thanks
Activity
2mol commentedon Dec 13, 2018
Thanks for the detailed case! I will try to reproduce this on my own system and report back. Some (possibly random) notes:
2mol commentedon Dec 13, 2018
Ok, I managed to also not have it work, so that's some progress. Some steps I took to narrow down the problem:
stack install cabal-installhie-wrapperin vscode, because it would otherwise guess ghc 8.6.2 for a 8.4.4 project (I'm guessing it uses the hie executable instead of the hie-wrapper one. We should help clarify that in the documentation once we solve this problem)hlint.yamlnot being found.~/Library/Application Support/Code/logs/20181213T120113/exthost1/output_logging_20181213T120116.It took me a really long time to find the logs, maybe you have a better way of getting them?Nevermind, I only now realized that you can conveniently select any log in the OUTPUT pane of vscode.Long story short, in my opinion the error message in the logs don't always relate to the actual problem. I now have this:
Notice the path above that says
luke. My guess is that something got hardcoded when the release was compiled? I will remove that hie and compile my own to compare.jneira commentedon Jan 9, 2020
hie not longer uses cabal-helper-wrapper and it is able to start using stack if there is no ghc on path so i think this should be fixed: @ianbrault @2mol feel free to reopen if it is not the case