5 ms·
Tangential, but what's the best way to get Elixir dev environment with database on Windows? A friend and I have been trying it for a project and for a NixOS dw
by e3bc54b2 4y ago
Tangential, but what's the best way to get Elixir dev environment with database on Windows?
A friend and I have been trying it for a project and for a NixOS dweller like me it was less than 2 minutes of work. But for her it has been never ending troubles.
Otherwise, Elixir and Phoenix are fantastic! No explicit JavaScript is necessary and that alone sells it for me, but the concurrency story is so easy to grok that I'm amazed nobody else managed to recreate it in so many years..
- conradfr 4y agoIt used to work on Windows but for some reasons nowadays I get trouble to make Elixir works with the OTP version the installer gets. I couldn't get Elixir 1.14 to work in September actually and reverted to 1.13.4, maybe I should try again.
- josevalim 4y agoMake sure you are also running Erlang/OTP 25. I will try to make this clearer in the installer!
- conradfr 4y agoFirst, part of my confusion was that the installer effectively asks your OTP path but I think it used to actually install OTP? So I didn't read the dialog carefully and didn't realized it changed, my bad :) But, after installing Elixir and pointing it to the otp 25.0.4 folder. > elixir -v > Cannot find file at 'c:\program files\erl-24.0\erts-12.0\bin\erl.exe' c:\program files\erl-24.0\erts-12.0\bin\erl.exe). This usually indicates a missing or moved file. I install erl-24.0 > elixir -v > Could not load module C:\Program Files\erl-24.2.2\erts-12.2.1\bin\erlexec.dll. I install erl-24.2.2 > elixir -v > {"init terminating in do_boot",{undef,[{elixir,start_cli,[],[]},{init,start_em,1,[{file,"init.erl"},{line,1191}]},{init,do_boot,3,[{file,"init.erl"},{line,889}]}]}} init terminating in do_boot ({undef,[{elixir,start_cli,[],[]},{init,start_em,1,[{_},{_}]},{init,do_boot,3,[{_},{_}]}]}) All the while erl-25.0.4 doesn't seem used (while being in the PATH env), I guess that's the problem but how do you enforce the OTP version? ---- edit: So I kinda made it work. First I noticed that I had erl-24.0 installed by Chocolatey (which I don't remember using ahah) so I uninstalled that. To make it clear, I'm on Windows 7 so the problems may come from that, but maybe it will help somebody else. But then the elixir-websetup.exe (2.2) would not actually complete any longer (while doing so when erl-24 was installed by Chocolatey?), it could not find the actual elixir downloaded installer in C:\<Me>\etc (not the valid user path in Windows 7 but maybe in 10+ ?) I then used elixir-websetup.exe 2.1 and got almost the same error but this time it complained about "elixir-v1.14.1 (Erlang/OTP 25)-setup.exe" while it actually downloaded "elixir-v1.14.1-setup.exe", which I was able to launch myself and finish the setup. And voilà, Elixir 1.14.1 ;)
- josevalim 4y agoThis is unexpected. Elixir should just pick whatever Erlang is on the path. This may be a bit too much, but maybe try removing all Erlang and Elixir versions and just picking the latest for both? If you are on WSL, then `asdf` or similar can do the trick.
- AlchemistCamp 4y agoMy company has a lot of Windows users due to its industry. I’ve made a doc for setting up Windows machines that I’ve been planning to share online but haven’t gotten around to yet. I’ll try to tonight and update this thread with a link. Tldr; use WSL2 and Ubuntu stable. Use ASDF. Put your app on the Linux part of the filesystem and if your Postgres installation is also on the Linux side, then have bash start it for you.
- marcus_cemes 4y agoI've been using WSL, which you can get from the Store now. Works for development and building releases, which then deploy to an Ubuntu VPS.
- bmitc 4y agoWhat are the issues? For running directly on Windows you can simply run the Elixir installer, which will install Erlang and Elixir. After that, I highly recommend using the ElixirLS extension for Visual Studio Code. Note that on Windows, you need to use `iex.bat` and `mix.bat` instead of just `iex` and `mix` when running the commands. For example, `iex.bat -S mix.bat`. (I have it setup where I can leave off `.bat` for `mix`, but I can't remember what I did off the top of my head, if anything, to get that. `iex` conflicts with a PowerShell thing, so `iex.bat` is required.) The other option is to install WSL2, install Erlang and Elixir there (I recommend using the asdf package manager (https://asdf-vm.com/ https://asdf-vm.com/). Once installed, use the Remote - SSH extension in Visual Studio Code on the Windows side to remote into the WSL2 instance. You could also download an official Elixir Docker container and again use Visual Studio Code (https://code.visualstudio.com/docs/devcontainers/containers https://code.visualstudio.com/docs/devcontainers/containers).
- OkayPhysicist 4y agoThe iex.bat thing can be circumvented by dropping the iex alias for Invoke-Expression in your $PROFILE.
- bmitc 4y agoAh, good point! I haven't thought of that before. Thanks for pointing it out.
- deleted 4y ago[deleted]
- Joel_Mckay 4y agoJust put a Debian or Alpine install in a minimum disk image file, and mount a host machine path as a samba share from inside the VM (i.e. the user can edit the VM code without having to import/export constantly). kvm/Hypervisor support on windows is patchy, but there are a lot of lower performance virtual machines that can work.
- willmorrison 4y agoWhat does your environment look like on NixOS? I had trouble connecting Phoenix to Postgres and ended up using SQLite for my test project. Do you have a database configured in shell.nix somehow?