Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to start Elixir. using Ubuntu wsl on Windows 10 #16

Closed
WolfDan opened this issue Oct 25, 2017 · 9 comments
Closed

Failed to start Elixir. using Ubuntu wsl on Windows 10 #16

WolfDan opened this issue Oct 25, 2017 · 9 comments

Comments

@WolfDan
Copy link

WolfDan commented Oct 25, 2017

I have configured my system so that elixir runs only on Ubuntu (No elixir etc.. installed in Windows)

Elixir and Phoenix works fine from the bash console (and I also manage to work in cmd by using bash.exe -c "elixir %*" in a .bat file), but ElixirLS simply don't work with WSL, here the log:

Failed to start Elixir.
error: {error,{elixir,{"no such file or directory","elixir.app"}}}
[Info  - 11:27:58] Connection to server got closed. Server will restart.

There is any way to make this work correctly? :D

Greetings

@JakeBecker
Copy link
Owner

Hm. For starters, this probably requires that this ticket be done first: JakeBecker/elixir-ls#12

It's going to be tricky to make this work out-of-the-box, but maybe it's possible to let the user override the launch command so you can run it with bash.exe. I'll look into it after ^ that ticket is done.

@yaBliznyk
Copy link

Try to use doskey
I set macros and use in cmd
image
https://docs.microsoft.com/en-us/windows/console/console-aliases documentation

@yaBliznyk
Copy link

You can use it for aliases like nodejs, elixirc, elixir, mix
and set aliases like phx.server=bash.exe -c "iex -S mix phx.server" and other

@JakeBecker
Copy link
Owner

In Windows, the server is launched from a batch file using the elixir executable in your path. If you alias that as @yaBliznyk recommends, it will probably work. Please re-open if you can't get it working with this approach.

@AlejandroHuerta
Copy link

AlejandroHuerta commented Mar 27, 2018

I haven't been able to get this working myself. I've added the alias to both powershell and cmd and made sure that they persist and load through sessions but the extension continues to throw an error for not being able to find elixir on my path. Does the extension run language_server.bat through cmd or powershell? Or is it controlled by some setting?

Any help would be appreciated as getting NIFs working on windows is a real pain outside of the WSL.

Edit: Just to follow up. I was not able to get this working. I ended up just getting everything working in windows and found Powershell Community Extensions which has a function for bringing in the MSBuild tool variables into the session to make building NIFs possible. It works.

@theevangelista
Copy link

I tried all of it, including changing the language_server.bat inside extensions, no luck, maybe because Im not that expert on bash and batch

@bravely
Copy link

bravely commented Jul 17, 2018

Yeah, I've done everything I could think of to get the above to work. I'm at an absolute loss, and I'm hoping this is somewhere on the roadmap.

@WolfDan
Copy link
Author

WolfDan commented Oct 19, 2018

To point it out, the only solution I found for it was to run Visual Code within WSL, and open your project there, it works just fine most of the time

On how to do it, check this https://gist.github.com/fdmnio/604c6b811939468fdad06e3fbba942ed

If you are working with nifs and want to make elixirls work inside windows natively, check my post on Elixir Forum

https://elixirforum.com/t/making-nifs-easier-to-work-with-on-windows-10-and-making-work-elixir-ls-too/17353

@AlejandroHuerta
Copy link

I attempted to look into this again. From what I can tell, the node.js child-process library doesn't seem to load in the doskey aliases. I haven't been able to figure out a way to make sure that happens. I then decided to simply modify the commands the extension used. So in language_server.bat, extension.js, and debugger.bat I simply changed elixir to wsl elixir which tells windows to direct the command to the default wsl. Unfortunately that doesn't seem to be enough as I've now gotten a different error which seems to indicate that the ElixirLS modules aren't being loaded.

[Info - 10:05:01 PM] Connection to server got closed. Server will restart.
** (UndefinedFunctionError) function ElixirLS.LanguageServer.CLI.main/0 is undefined (module ElixirLS.LanguageServer.CLI is not available)
ElixirLS.LanguageServer.CLI.main()
(stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
(elixir) lib/code.ex:232: Code.eval_string/3

Not sure where to go from here.

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

No branches or pull requests

6 participants