8
votes

I'm on Windows and I am trying to install the bcrypt_elixir module.

I get the following error:

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

Here is a terminal screenshot of the error:

Error

Here is my deps function from mix.exs:

defp deps do
    [
      {:phoenix, "~> 1.3.0"},
      {:phoenix_pubsub, "~> 1.0"},
      {:phoenix_ecto, "~> 3.2"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.10"},
      {:phoenix_live_reload, "~> 1.0", only: :dev},
      {:gettext, "~> 0.11"},
      {:cowboy, "~> 1.0"},
      {:comeonin, "~> 4.0"},
      {:elixir_make, "~> 0.4.1"},
      {:bcrypt_elixir, "~> 1.0"}
    ]
  end
6

6 Answers

8
votes

I faced same problem during distillery setup with my elixir project.

Installing package resolve issue as shown below.

I found bcrypt_elixir need to install make and build-essential from Elixir Forum.

platform:- ubuntu

$ sudo apt install make

$ sudo apt-get install build-essential

4
votes

bcrypt_elixir uses Windows' NMake (cf. bcrypt_elixir's Makefile.win).

It seems like you don't have NMake installed.

From NMake's documentation:

NMAKE is included when you install Visual Studio or the Visual C++ command-line build tools. It's not available separately.

So you need to download Visual Studio in order to get NMake. Then you should be able to compile bcrypt_elixir.

If you already have NMake, make sure nmake.exe is located under a directory from your path.

4
votes

For Visual Studio 2019 (VS2019) :

cmd /K "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
2
votes

In windows 10, you must add NMAKE to your path enter image description here

After that you can run mix deps.compile until see message like this: enter image description here

After that you must run cmd as suggest from nmake:

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

Run this command on cmd and run mix deps.compile normarly.

1
votes

Actually looking at this a bit closer, since you're running Cygwin and trying to build bcrypt under Cygwin, nmake doesn't even enter into the question. You need to install make into Cygwin. Re-run the cygwin installer, select the Devel category and then under Devel look for make.

EDIT:

Ok, so if I had to guess I'd say either you need to

a.) Stop trying to build everything under the Cygwin prompt--if bcrypt_elixir is detecting that it's on Windows, it's going to look for nmake and nmake isn't part of Cygwin.

You didn't specify how you're looking for nmake but if I were you I'd try this from the C:\Program Files (x86) directory.

dir /s nmake.exe

Mind you run that from a Windows cmd prompt--it won't work from the Cygwin shell!

b.) Somehow set bcrypt_elixir to think it's on Linux so it looks for make (which is not the same as nmake).

Basically I think the simplest answer would be to try to run mix phx.server from a normal Windows cmd prompt and then go from there. Or if you need Linux, then install virtual box and put a Linux VM on the machine and proceed that way.

1
votes

I found that, running on Windows, it was the latest version of erlang OTP, version 21, that was causing the problem. I uninstalled this version and went for version 20 (which installs erlang 9.3 and latest version of Elixir then looks for this version when being compiled) and then bcrypt_elixir compiled al