State of windows bash?


who is using windows bash with phoenix / elixir? Are there any disadvantages to a real ubuntu system?


I use the VS native tools command prompt to compile. But most of the time I use MSYS.

I run my program with iex -S mix so I can interact with it while running, but this also means if erlang crashes bash also crashes, what a bummer, I lost all the console output, after that I switched to MSYS.

I use MSYS as well, no issues as long as ran in an admin prompt.

Windows CMD - and generally Windows - might have some issues with comeonin - you have to download VS C++ and run it via Ctrl + R and pasted command from error log. Also I faced difficulties on Windows (that didn’t happen on Mac) using ExAws for SNS to create application endpoints - Windows thrown me 403 error, whereas on Mac - with the very same config - it worked smoothly.

Also Windows CMD won’t autocomplete any of your Elixir expressions!

No terminal program I’ve found even running in the msys or even cygwin bash shell does. I’m thinking elixir itself is preventing command completion on windows at this point…

I use the WSL, elixir and Phoenix works without problem. Comeonin compiles fine. My only problems so far:

  • Phoenix keeps recompiling a lot of files, as if they were changed all the time. Not sure if it’s because of WSL, VSCode out just me somehow.
  • Appsignal’s plugin does not compile.

Fixed if you run in an admin prompt. Windows does not allow symlinks unless you are either admin or guest, normal uses cannot, yes it is stupid.

Not tried it yet, I need to, I have that free year of it but I’m entirely unsure what I want to use it on, so many options… >.>

An alternative to considering Windows stupid is asking Google how to create symlink on windows. You get an answer like:
Run SecPol as admin, navigate to Computer configuration / Windows Settings / Security Settings / Local Policies / User Rights Assignment / Create symbolic links, right click, add yourself to the grroups having rights to create symlinks, logout/login (tried on Windows 10 pro)
Maybe this solve your problem about frequent recompilation.

That can give a non-admin user access, but they still have to elevate the command prompt when I tried it, it is not transparent. Windows has a good reason for why it is the way it is (which is due to how poorly NTFS was designed) and that is because a user could point to a file with a different set of permissions then access what they cannot. A Guest user is restricted in where they can point however.

Thanks for the remark. I checked on my Windows 10. After I added the permission (and not before), the command mklink link target worked and Phoenix 1.3 did not complain. This is true in CMD and NodeJS prompt.

I had just installed the Windows 10 creator, and because I also use Bash, I have the developer mode enabled.

From Microsoft:

In Windows 10 Creators Update, the admin-rights restriction has been lifted for users who have enabled developer mode, allowing symlinks to be created from an un-elevated Console.


With all this we did not answer the original question, I will try Windows bash environment too and keep you informed.

Ooooo, that will be quite convenient!

I have successful installed Elixir on windows 10 bash environment (the one provided by Microsoft, nothing to do with Cywin).This works will but only since the Windows ‘Creator update’ which is distributed these days (you can force immediate update if desired). After the update of Windows, you must re-create your bash environment to migrate to Ubuntu 16.04.2.
Then you can install Elixir by following exactly the instruction of the Elixir documentation (do not try any of the workaround proposed to install on a previous version).
See the following post for details of the new features of the bash environment on Windows.

NOTE: You are not supposed to edit files from Windows inside the Unix environment. But I created an Elixir project my under my Window home directory from the bash environment and I edit the Elixir files from Windows using VSCode. Works fine. However the symbolic links created by Unix on your Windows folder are not recognized as symbolic links, they look as regular files. Do not touch or use them, they must be managed from the Unix (bash) side.

Hope this helps and answers the original question.

1 Like

Thanks. Are changes in files in windows folders detected from phoenix?

Yes, at least to the extend I checked.
I installed the project to test it (you must first sudo apt-get install inotify-tools if it is not already installed, this is not documented).
I tried watching a directory in the Unix environment (under /home/...) and in the Windows environment (under /mnt/c/...). This worked successfully when a file was touched/added/deleted from the bash prompt.
I also tried to modify the watched directory under /mnt/c/... from Windows (creating a file with the explorer) and it worked fine.
So watching seems to work. I am not sure how symbolic links impact watching (watching a Unix symbolic link pointing to a Unix or Windows directory, or watching a windows symbolic link). This is left as an exercise for the reader :slight_smile:

1 Like

Am I the only one for who autoreload doesn’t work? I’m on Win10 Creators Update, Ubuntu 16.04, installed inotify-tools, the entire phoenix app works except automatic reload. I edit my files from Windows, so Phoenix finds them them in /mnt/c/.... But no autoreload, no errors either.

Meanwhile, webpack autoreloads files just fine. I’m eager to dive deeper but I’m not sure where to look. Any suggestions?

Thanks :slight_smile:

Hmm, I’m on Windows 10 but using mingw, not bashshell, and I have no issues with auto-reload as long as I run it with admin perms.

I had this same problem and just discovered the fix. Not only to I run VSCode as Administrator as recommended by others, but I notice that device encryption was turned on by default on my machine. When I shut that off my app started compiling only the files I had changed when I recompile.

I have had auto-reload stop working. It seemed to be connected to generating javascript errors.

My two main machines are Linux Mint and a Surface book using bash. when auto-reload fails I have to go to the /assets directory and manually do a brunch build. It seems to happen more often on the windows computer, but I’ll take note of it.

I’ve tried editing files in IntelliJ community inside windows with a bash window open but recently switched to vim instead. I got errors related to file ownership I believe, but that has ceased when using vim.

Typically, there’s 2-3 bash windows open. One is running vim and is split in multiple files. One is running phoenix so I can catch the error messages or anything I’ve pushed to the console, the other is for on the fly git/iex sessions when needed. It works surprisingly well, all things considered. The only laggy parts seem to be the initial phoenix startup. Sometimes it takes quite a bit to get going.