Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

VSCode "cannot satisfy package id ..." #1660

Closed
shika-blyat opened this issue Feb 18, 2020 · 7 comments
Closed

VSCode "cannot satisfy package id ..." #1660

shika-blyat opened this issue Feb 18, 2020 · 7 comments

Comments

@shika-blyat
Copy link

I saw there is many issues related about this, which all result being a ghc version problem. And i think i'm in the same case, but i don't see how i could fix it.
hie --version
gives me:
Version 1.1, Git revision 66163e0f69ce4f9239c1723cb27a67e56156ec5d (3782 commits) x86_64 ghc-8.6.5
So in stack.yaml i changed the resolver to:
resolver: ghc-8.6.5
but i still get errors like:

"cannot satisfy -package-id euler-project-0.1.0.0-JfKp1DRbv71HkkeHYjMrvZ\n (use -v for more information)"

and

Fail on initialisation for "C:\Users\...\Documents\Haskell\euler-project\Setup.hs". Could not obtain flags for: "Setup.hs".

in VSCode notifications.
I don't know if the second error message is related to the first one though.

@fendor
Copy link
Collaborator

fendor commented Feb 18, 2020

You can not open Setup.hs files. They are fundamentally different to other Project files.
Are you sure that your vscode plugin is up-to-date?
Could you link the log from Debug mode https://github.com/alanz/vscode-hie-server#investigating-and-reporting-problems

@shika-blyat
Copy link
Author

shika-blyat commented Feb 18, 2020

Are you sure that your vscode plugin is up-to-date?

Yes it is

Could you link the log from Debug mode

https://paste.artemix.org/s/HcGrmg

You can not open Setup.hs files. They are fundamentally different to other Project files.

Could you explain me why please ?

@Mesabloo
Copy link

Seems like there already is something wrong in your trace.
As far as I could read on github, the error

'stty' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

is related to a broken dependency of stack on Windows. (it also already has been reported here: #1428)
See commercialhaskell/stack#4968 for more info about that.
A workaround is given there, but the PR status is still unknown as fixes proposed aren't satisfactory enough.

I don't know if it would fix the problem (that is, HIE not working) but I think it is worth a try.

@fendor
Copy link
Collaborator

fendor commented Feb 18, 2020

Could you explain me why please ?

Sure. This Setup.hs file is used to actually build your project. All haskell projects built with stack or cabal are at some point built with Cabal the library (note the capital 'C'). Cabal is the specification how to actually build a haskell package and the Setup.hs uses the Cabal library to build the project. Cabal Spec: https://www.haskell.org/cabal/proposal/pkg-spec.pdf

We can not easily load this file since it could contain arbitrary code importing arbitrary dependencies and the build tools stack and cabal expose no programmatic way of accessing the required build-flags for ghc to actually compile this file. E.g. to compile a normal Setup.hs, you need something like ghc -package Cabal-3.0.0.0 -package base-4.12.0.0 Setup.hs. However, these flags and the location of the libraries, as well as package-db that is used by ghc, might differ for each Setup.hs.
Rough (and incomplete) reasoning why loading of Setup.hs is difficult.

@shika-blyat
Copy link
Author

shika-blyat commented Feb 18, 2020

Okay thank you for the explanation.
With the @Mesabloo advices i tried to investigate that error message:

'stty' n'est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.

(which just means stty isn't recognized as a valid command).
So i tried to call stty and stty size and they both respectively returns me:

speed 38400 baud; line = 0;
-imaxbel iutf8
-echoe -echok -echoctl -echoke

and 28 120, either on powershell or cmd.
But:
on powershell, which stty returns me:
/usr/bin/stty
while on cmd locate stty returns me a blank line (meaning it didn't found it).
nevermind, it also works on cmd, i wasn't using the right command, where stty returns me:
C:\Program Files\Git\usr\bin\stty.exe

@Mesabloo
Copy link

Ok, so after a little bit of head scratching (as I'm not a proficient Windows users) I managed to install HIE on my Windows 10 and get it to work properly in VSC.

As expected, I'm getting the stty error, but it doesn't seem to affect anything.
I have been successfully loading a project in VSC without any crash, and everything seems to work. (at least, from what I tested)

I'm quite unsure at this point where does your error come from.

@shika-blyat
Copy link
Author

shika-blyat commented Feb 19, 2020

Okay it works. The problem was coming from my GHC, in my path. I don't why but it was broken.
I reinstalled it with ghcup and it worked without any problem.
I think this issue can be closed so i'll close it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants