rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.31k stars 94 forks source link

Create new Haskell Module - Error adding module to project: null #605

Closed kaminsod closed 4 years ago

kaminsod commented 4 years ago

Related, but somewhat different from: https://github.com/rikvdkleij/intellij-haskell/issues/567

Plugin version: 1.0.0-beta78 Intellij version: 2020.2.1

In the event log:

12:52 a.m.  Cannot run program "/usr/bin/stack" (in directory "/home/kaminsod"): error=2, No such file or directory

12:52 a.m.  Executing `/usr/bin/stack --numeric-version` failed: /usr/bin/stack --numeric-version: 

So it seems to always fall back to /usr/bin/stack even when another path is selected.

rikvdkleij commented 4 years ago

Thanks for reporting!

I can't reproduce your issue and also wonder if the lines in the Event log relates to the error.

Can you give some more info about how to reproduce this issue?

kaminsod commented 4 years ago

This was done right after updating intellij to 2020.2.1 and installing the plugin version 1.0.0-beta78, with all the necessary restarts.

There is no global stack in /usr/bin/stack.

The steps are exactly:

File -> New -> Project -> Haskell Module -> (select user's local stack - version 2.3.3) -> next -> finish

I'm not sure about the source of the event log, but the timestamp matches with the project creation time. It could be that it runs those commands while trying to detect the global stack install before project creation, or it tries to use /usr/bin/stack ignoring the user-selected stack path.

rikvdkleij commented 4 years ago

Does this issue prevent you from using the plugin?

kaminsod commented 4 years ago

This, along with https://github.com/rikvdkleij/intellij-haskell/issues/567 do prevent the creation of new haskell projects from intellij. However, I was able to work around the issue by creating a stack project from the command line, adding a symlink in /usr/bin/stack pointing to user's local stack, and importing the existing project. The plugin works when importing and working on an existing project.

rikvdkleij commented 4 years ago

Ok, good to know!

kaminsod commented 4 years ago

By the way, just wondering - how does the plugin detect stack? My local stack is in the path, and 'stack path' would return something like:

...
local-bin: /home/user/.local/bin
...

The local-bin seems like a better default than /usr/bin/stack.

rikvdkleij commented 4 years ago

The plugin doesn't detect stack. In a previous version the plugin was using stack from the PATH but that didn't work out for a number of users so I switched back to the SDK solution.

The plugin's stack path defaults are per OS.

The path to stack depends on how stack was installed but I have no problem with changing the default. See e.g. https://docs.haskellstack.org/en/stable/install_and_upgrade/

The local-bin seems like a better default than /usr/bin/stack.

That's something else. That's the folder which contains the binary after a stack install in a project.

kaminsod commented 4 years ago

Ah, thanks for the explanation.

mcarifio commented 4 years ago

For ubuntu 19.10 and 20.04, I don't install the default stack package because it's fairly old. Therefore there is no /usr/bin/stack unless I explicitly create a symlink to (say) ~/.local/bin/stack. I guess I don't understand the statement "PATH didn't work out". Why not? Wouldn't you do something like env to find the correct executable with the correct switches?

Anyways, I can't really run an existing project from the plugin. Ubuntu 19.10, Intellij idea 2020.2.1, stack 2.3.3 and Intellij-Haskell 1.0.0-beta78. stack build and stack run at the command line both work. stack run --verbose seems to do a lot of stuff which I don't yet understand. I'm pretty new to haskell and stack.

rikvdkleij commented 4 years ago

@mcarifio

Why not?

I was referring to issue #587

I can reproduce this issue on Ubuntu. So will fix this.

mcarifio commented 4 years ago

Awesome. Great plugin. Ty.

ndrsllwngr commented 4 years ago

@rikvdkleij I just want to inform you that this bug also affects macOS. But we were able to restore an older .iml file which we now have checked in git so that colleagues can also use your extension.

rikvdkleij commented 4 years ago

@ndrsllwngr Thanks for the info. The fix should also work for macOS.

ndrsllwngr commented 4 years ago

@rikvdkleij Thank you a lot; your extension besides this bug works great and supports us in many ways!

rikvdkleij commented 4 years ago

Should be fixed in beta79.

rikvdkleij commented 4 years ago

Please reopen if still an issue.