Cygwin for compiling

Hi all

I develop elixir on my windows computer and using cygwin for compiling my projects. I have to use windows because, our company do not allow using mac.

Compiling elixir project I encounter some issues like:

$ No file named /cygdrive/c/Elixir/bin/mix
-bash: No: command not found

I do not know what is the problem here. I have a mix file in the elixir/bin folder:

Or is there any other bash you suggest to use instead of cygwin?


For some reason, No file named /cygdrive/c/Elixir/bin/mix got sent to bash as the command to run, usually this is by you typing it in or pasting it in. So my only advice is to use the correct command.

I tried to get dependencies:

$ mix deps.get
No file named /cygdrive/c/elixir/bin/mix

And got this error.

What about iex, does it start correctly?

Yes, it starts correctly.

So, Elixir was installed and it’s just doesn’t see mix in the path. Mb @OvermindDL1 could help? :slight_smile: AFAIK he works with Elixir on Windows.

Yes am I working with windows.

Please do ls -l /cygdrive/c/elixir/bin and post its output.

Here we go:

$ ls -l /cygdrive/c/elixir/bin
total 31
-rwxrwx---+ 1 Administrators Domain Users 3819 Dec  3 23:00 elixir
-rwxrwx---+ 1 Administrators Domain Users 4673 Jan  5 11:32 elixir.bat
-rwxrwx---+ 1 Administrators Domain Users 1030 Dec  3 23:00 elixirc
-rwxrwx---+ 1 Administrators Domain Users 1094 Dec  3 23:00 elixirc.bat
-rwxrwx---+ 1 Administrators Domain Users 2199 Dec  3 23:00 iex
-rwxrwx---+ 1 Administrators Domain Users 2369 Dec  3 23:00 iex.bat
-rwxrwx---+ 1 Administrators Domain Users   45 Feb 21  2016 mix
-rwxrwx---+ 1 Administrators Domain Users   95 Dec  3 23:00 mix.bat
-rwxrwx---+ 1 Administrators Domain Users  576 Oct 19  2015 mix.ps1

OK, there seems to be something weird going on…

I can’t say for sure, so this is a guess and might be not what is really happening, but I will provide the steps necessary to check.

I think, that for some reason mix.bat is started instead of mix, it is able to start elixir in an environment that is not cygwin aware anymore, so elixir is not able to find /cygdrive/c/elixir/bin/mix, because it simply doesn’t exist in that context.

When one tries to start elixir with a file that does not exist a similar message appears, this is the main reason to think this:

$ elixir foo
No file named foo

To actually check if my theory is correct, you can do the following:

$ mv `which mix`.bat `which mix`.bat.bak
$ mv `which mix`.ps1 `which mix`.ps1.bak

This should rename that bat and powershell wrappers and so again the system should not find and run them anymore and mix should work again.

But mix will not be available anymore from standard windows command prompt, but cygwin only.

If you need to revert that change you can do the following:

$ mv `which mix`.bat.bak `which mix`.bat
$ mv `which mix`.ps1.bak `which mix`.ps1

Personally I do not use cygwin as POSIX-wrapper anymore for about 2 years now, since there were problems everywhere. I had a much better success story after switching to MINGW64.

First of all, thanks so much for response. I installed MINGW64 and now, how can I execute it?

1 Like

I downloaded and try to execute iex and does not work.

Then I try to install elixir with

pacman -S elixir

and as result:

$ pacman -S elixir
error: target not found: elixir

What am I doing wrong?

Well, MSYS2 has no elixir package, so you need to compile it by yourself. I’d only recommend this when you have a Unix/Linux background and you can install elixir and erlang by hand over there already or you will destroy your mingw env before it was even properly set up.

Before switching into just another unknown terrain, please check if that workaround with moving bat and ps1 away does work.

No, it does not work. Sorry. Which bash is easy to use? How to use with MINGW64?

A native bash running under linux is the easiest, but you already mentioned the impossibility for you.

So I will give you some options, in no particular order

  • Install Ubuntu in a virtual machine. Might involve massive hard disk overhead and some time to set it up to your needs.
  • Install Vagrant and use it. For a phoenix project of mine I did once create a Vagrantfile which sets up an image which has all necessary stuff available on a CentOS 7 guest. I will try to extract necessary parts and post it somewhere when I am back home and my older son is in bed (about 6 hours from now)
  • A POSIX-Wrapper that actually works :wink: But unfortunately I do only know Cygwin which had many flaws back than and MSYS2/MingW64 which I’d only recommend to people familiar with linux‌.
  • An alias in ~/.bashrc, roughly like this: alias mix="/cygdrive/c/elixir/bin/elixir c:/elixir/bin/mix". After you changed your ~/.bashrc, you need to restart all open bash-sessions or re-source ~/.bashrc to make that change happen.

The last one might be the easiest, but before that try it out directly: /cygdrive/c/elixir/bin/elixir c:/elixir/bin/mix, if and only if this will get you the expected output of mix, you can insert that line from above in your RC-file and go for it.

I tried it and it does not work at all. I will start to cry. I hate windows.

What did you try and which errormessage did you got?

The same error message.
I think I should switch to ubuntu.

In the command I gave you, there is no “/cygdrive/c/Elixir/bin/mix”, so the error message can’t be the same unless something is really borked!

Sorry if I sounded a bit harsh. But I really try to figure out where this message comes from and why. So the exact messages as they are printed to your console are crucial information.

Maybe we can even find a final solution here and on top of that report a bug upstream, fix included (or some warnings at least).

Uh, I may have missed the reason, but why use cygwin with elixir? I use just a windows bash install (mingw64 I think, and even then only because I am more comfortable with linux tools than Windows ones) and the stock command prompt and powershell without issue. Cygwin sets up a very…odd environment on Windows.

What happens if you do mix in a normal windows command prompt without the prior post listed renames?