0

I seem to be getting a peculiar problem which is hard to even search up online. I'm using stack and have already created a project from my professor but when I try to run it with stack build or stack run

I get this error:

InvalidAbsFile "C:\\Programs\\Projects\\bimaru2\\\"C:\\Windows\\system32\\ghc-9.0.2.exe"

The error is mentioned here: https://hackage.haskell.org/package/path-0.9.2/docs/Path-Windows.html#v:InvalidAbsFile but this description is not telling me anything. I found someone with a similar problem: InvalidAbsFile error when running "stack" on windows in an existing project. I removed Java but the problem still persists. I tried changing directories and all, so the first path is printed according to where the project is. My version of ghc was 8.10.7 and I reinstalled 9.2.4, so I have no idea where 9.0.2 comes from (nor do I have it in C:\Windows\system32\ directory). This is the second project I get this error with, but the first one I solved by setting system-ghc in stack.yaml file from true to false (although the professor mentioned that then it did not compile for him until he changed it back when we turned in the assignment).

packages:
- .

resolver: lts-18.28
compiler: ghc-8.10.7
compiler-check: match-exact
system-ghc: false
install-ghc: false

I tried the same with this one, but it did not work. If needed, I will provide a link to the github repo where the project is located. I'd be really grateful if you could help me get the project running. Thanks in advance!

  • 1
    That path certainly looks wacky, with an absolute path embedded in a relative path. Try to figure out where that path came from and fix it. – amalloy Oct 20 '22 at 20:57
  • @amalloy Do you have any idea why the relative and absolute paths might get mashed together? I checked both directories that are mentioned in the error and everythings seems to be fine there. Also, googling about relative and absolute paths only leads me to guides on the difference between the two. – Raskolnikov Oct 20 '22 at 21:20
  • 1
    No, I have no idea what's in your stack config files. – amalloy Oct 20 '22 at 23:40
  • If you set `system-ghc` to `false` I think you have to set `install-ghc` to `true`. Otherwise you are telling `stack` "don't install ghc but do not use the ghc installed in the system". Also, do you have `ghc` install in the system?? if you run `ghc --version` in a console what does it output? – lsmor Oct 21 '22 at 11:23
  • This solved my issue: I reinstalled Windows (Windows called it "Reseting my computer"). When you install GHC again and get the project (as this seems to be happening only when it's an already existing project), run stack setup inside the directory where the project is, even if you already did so elsewhere after installing GHC. The problem seems to be with environmental variables. If you get this error and know where exactly it fails, you might not need a reset. – Raskolnikov Oct 21 '22 at 11:53

0 Answers0