0

I am getting the below error while running mix ecto.create to create the postgres DB.

==> argon2_elixir
could not compile dependency :argon2_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile argon2_elixir", update it with "mix deps.update argon2_elixir" or clean it with "mix deps.clean argon2_elixir"
==> snitch_core
** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable,
please make sure it is correct.

I am defining it in the mix.exs file under apps folder as below:

  # auth
  {:elixir_make, "~> 0.4.2"},
  {:comeonin, "~> 4.1.1"},
  {:argon2_elixir, "~> 1.3.3"},

Tried to recompile the package as suggested in the error message but nothing helped.

Appreciate help in this regard.

  • 1
    Check if ˋnmakeˋ is on your path. If not, add it or define the ˋMAKEˋ environment variable prperly. – aventurin Dec 24 '18 at 09:45
  • I checked - it is already added in the PATH in env variable. PATH is C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\nmake.exe – Sayak Bhattacharya Dec 24 '18 at 10:36
  • It doesn't matter if nmake is in the path or not if you don't have the environment variables (e. g. %INCLUDE%) defined correctly. nmake uses those environment variables to find files it needs. Given what turns out to be the answer below, I'd say you should simply build a .cmd file that sets these variables before attempting to run mix. – Onorio Catenacci Dec 26 '18 at 16:07
  • Found any solution yet? – Imran Abdalla Jan 15 '23 at 10:36

2 Answers2

1

It appears that you don't have nmake installed. You're on Windows I presume? Install nmake one way or another, see for example this answer.

zwippie
  • 15,050
  • 3
  • 39
  • 54
  • `nmake` is installed. I even ran the `nmake.exe /F MAKEFILE` command in Visual Studio command shell without any issues. Yes I am in WIN 10. – Sayak Bhattacharya Dec 24 '18 at 07:30
1

I was able to solve it finally. Here is the general approach to attack the problem and solve it, irrespective of your specific issues.

First, I copied the nmake.exe from the visual studio folder C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\ and pasted in System32 folder. Ran the command mix ecto.create and received a changed elaborate error which solved the issue. Here is the output of the error: ** (Mix) Could not compile with "nmake" (exit status: 2). One option is to install a recent version of [Visual C++ Build Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools) either manually or using [Chocolatey](https://chocolatey.org/) - choco install VisualCppBuildTools`.

After installing Visual C++ Build Tools, look in the "Program Files (x86)" directory and search for "Microsoft Visual Studio". Note down the full path of the folder with the highest version number. Open the "run" command and type in the following command (make sure that the path and version number are correct):

cmd /K "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64

This should open up a command prompt with the necessary environment variables set, and from which you will be able to run the "mix compile", "mix deps.compile", and "mix test" commands.`

Follow this line by line, and success is at your feet. :)