3This page serves as a dumping ground for setup problems and their resolutions. We recommend everyone first runs `ghcide` on the console to check what files in their project load, and only the moves on to using `ghcide` through an editor (e.g. VS Code).
5## "mismatched interface file versions"
7If you see a problem such as:
15 test/Spec.hs:1:1: error:
17 /Users/daml/.stack/programs/x86_64-osx/ghc-8.6.4/lib/ghc-8.6.4/base-4.12.0.0/Prelude.hi
18 mismatched interface file versions (wanted "8065", got "8064")
21The cause is that your program is configured to use a different GHC to the one you built `ghcide` with. In `ghcide` you can view the version number it was compiled with on the first line as:
24ghcide version: 0.0.3 (GHC: 8.6.5)
27You can see the version of GHC being used by this project in the second-last line of the output with `ghc-8.6.4/`, or in in mismatch interfaces of wanted `8065` (aka 8.6.5), got `8064` (aka 8.6.4). The solution is to use the same GHC version in both places.
29## “failed to load interface for ‘…’ There are files missing”
31If you see a problem such as:
34File: ./src/File/FileStream.hs
39 Program error: Failed to load interface for ‘Data.DList’
41 There are files missing in the ‘dlist-0.8.0.7’ package,
42 * ./src/File/FileStream.hs
43 try running 'ghc-pkg check'.
44 Use -v to see a list of the files searched for.
47It might be caused by `ghcide` picking up the wrong cradle. In
48particular, this has been observed when running in a `nix-shell` where
49`ghcide` picked up the default cradle. Try setting the cradle
50explicitly, e.g., to use the cabal cradle create a `hie.yaml` file
51with the following content:
54cradle: {cabal: {component: "mylibrary"}}
57If you are using stack, find the list of names you can use:
61 mypackage:exe:mypackage-exe
62 mypackage:test:mypackage-test
64and create a `hie.yaml` file as follows:
66 {stack: {component: "mypackage:lib"}}
68## ghc: readCreateProcess: does not exist
70On Linux: try `stack exec ghcide`` instead of `ghcide` directly.
72I was getting this in Windows: `ghcide.exe: ghc: readCreateProcess: does not exist (No such file or directory)`
74And we figured a hack around for this:
76VSCode user or workspace settings, add these:
78 "hic.executablePath": "stack",
79 "hic.arguments": "exec ghcide -- --lsp"
81Since I use stack. Required if you don't have a `ghc` on your path.
83## Could not find module ...
85Try adding an explicit `hie.yaml` file and see if that helps.
87## Ambiguous main module
94ghcide: CradleError (ExitFailure 1) ["Failed to parse result of calling stack","","* * * * * * * *","The main module to load is ambiguous. Candidates are: ","1. Package `mypackage' component mypackage:exe:mypackage-exe with main-is file: /home/user/mypackage/app/Main.hs","2. Package `mypackage' component mypackage:exe:otherbin-exe with main-is file: /home/user/mypackage/app/otherbin.hs","You can specify which one to pick by: "," * Specifying targets to stack ghci e.g. stack ghci mypackage:exe:mypackage-exe"," * Specifying what the main is e.g. stack ghci --main-is mypackage:exe:mypackage-exe"," * Choosing from the candidate above [1..2]","* * * * * * * *","","<stdin>: hGetLine: end of file"]
97Add a `hie.yaml` file to specify the module, e.g.
99 cradle: {stack: {component: "mypackage:exe:mypackage-exe"}}
101## Works in `ghcide` but not my editor
103Does `ghcide` alone work on the console? Did you first enter a Nix shell? Or run `stack exec ghcide`? If so, there are two options:
1051. Run your editor via the same mechanism, e.g. `stack exec code`.
1062. Change the extension to use the executable as `stack` and the arguments as `exec -- ghcide --lsp`.
110If you are using packages installed by Nix, then often Nix will set `NIX_GHC_LIBDIR` to say where the libraries are installed. `ghcide` can cope with that. However, sometimes the `ghc` on your shell will actually be a shell script that sets `NIX_GHC_LIBDIR`, which `ghcide` can't find. If that happens, you need to either set `NIX_GHC_LIBDIR` (so `ghcide` can see it) or use a proper [Nix compatible wrapper](https://github.com/hercules-ci/ghcide-nix) over `ghcide`.
112## ghcide: this operation requires -fexternal-interpreter
114This can happen if you have a GHC compiled without GHC library support. This seems to be [the case](https://github.com/input-output-hk/haskell.nix/issues/313) with `haskell.nix` at the moment.
116## Symbol’s value as variable is void: capability
118As described [here](https://github.com/emacs-lsp/lsp-mode/issues/770#issuecomment-483540119) and [here](https://github.com/emacs-lsp/lsp-mode/issues/517#issuecomment-445448700), the default installation of `lsp-mode`, `lsp-ui`, `lsp-ui-mode` and `lsp-haskell` as described in [ghcide's "Using with Emacs" section](https://github.com/digital-asset/ghcide/#using-with-emacs) may result in the following error message:
121Symbol’s value as variable is void: capability
124This can be caused by either an old version of the Emacs package `dash`, or a cached `.elc` file for an old version. A fix consists of (re)moving the old package from ~/.emacs.d/elpa/ and installing it again, e.g. via M-x `package-list-packages` RET and M-x `package-install` RET `dash` RET. If this is not enough,
127find ~/.emacs.d -name '*.elc' -exec rm {} \;
130(which causes recompilation of all bytecode-compiled scripts.)
133## Docker stack builds
135You're likely to see `ghcide: (ExitFailure 1,"","")`. Because ghcide can't get at the ghc installed inside Docker, your best bet is to `stack exec ghcide` and make sure `ghcide` is installed within the container. Full details at [issue 221](https://github.com/digital-asset/ghcide/issues/221).
137## stty error on Windows + Stack
139If you get an error like:
142ghcide.exe: CradleError (ExitFailure 1) ["Failed to parse result of calling stack","'stty' is not recognized as an internal or external command,","operable program or batch file."
145Then the workaround from https://github.com/haskell/haskell-ide-engine/issues/1428#issuecomment-547530794 might help.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list