Installing GHC with Stack Permission Denied

I have just installed stack and I am trying to compile my sample.hs file. However I am getting the following error:

←[0mPreparing to install GHC to an isolated location. This will not interfere with any system-level
installation.←[0m
←[0mAlready downloaded ghc-9.4.7.←[0m
←[0mAlready downloaded 7z.dll.←[0m
←[0mAlready downloaded 7z.exe.←[0m
←[0mC:\Users\HP\AppData\Local\Programs\stack\x86_64-windows\ghc-9.4.7\mingw\bin\libwinpthread-1.dll: removeDirectoryRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:removePathRecursive:removeContentsRecursive:removePathRecursive:DeleteFile “\\?\C:\Users\HP\AppData\Local\Programs\stack\x86_64-windows\ghc-9.4.7\mingw\bin\libwinpthread-1.dll”: permission denied (Access is denied.)←[0m

I’m also a Stack/Windows user. I am not sure why Stack is complaining, however, you could try deleting the C:\Users\HP\AppData\Local\Programs\stack directory and trying again. Stack will recreate everything that it needs in that directory, so it can be safely deleted.

1 Like