Reputation: 1519
I tried installing the addict package in my Phoenix Project however I'm getting an error. I tried the exact same process on a colleague's Mac and he does not get the error, while I do on Windows. The error comes from the comeonin dependency. I've also tried it in both Phoenix 0.14 and the 0.15 update that was released yesterday.
Steps to recreate:
Create a new project and run it
$ mix phoenix.new testAddict
$ cd testAddict
$ mix ecto.create
$ mix phoenix.server
Add addict in mix.exs:
defp deps do
[{:phoenix, "~> 0.15"},
{:phoenix_ecto, "~> 0.8"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 1.4"},
{:phoenix_live_reload, "~> 0.5", only: :dev},
{:addict, "~> 0.0.5"},
{:cowboy, "~> 1.0"}]
end
Compile dependencies:
$ mix deps.get
Results:
Running dependency resolution
Dependency resolution completed successfully
addict: v0.0.5
comeonin: v0.11.3
mailgun: v0.0.2
* Getting addict (Hex package)
Checking package (https://s3.amazonaws.com/s3.hex.pm/tarballs/addict-0.0.5.tar)
Using locally cached package
Unpacked package tarball (c:/Users/mesos_000/.hex/packages/addict-0.0.5.tar)
* Getting mailgun (Hex package)
Checking package (https://s3.amazonaws.com/s3.hex.pm/tarballs/mailgun-0.0.2.tar)
Using locally cached package
Unpacked package tarball (c:/Users/mesos_000/.hex/packages/mailgun-0.0.2.tar)
* Getting comeonin (Hex package)
Checking package (https://s3.amazonaws.com/s3.hex.pm/tarballs/comeonin-0.11.3.tar)
Using locally cached package
Unpacked package tarball (c:/Users/mesos_000/.hex/packages/comeonin-0.11.3.tar)
Run Phoenix project again:
$ mix phoenix.server
Results (here's the error):
==> mailgun
Compiled lib/mailgun.ex
Compiled lib/client.ex
Generated mailgun app
==> comeonin
could not compile dependency comeonin, mix compile failed. You can recompile this dependency with `mix deps.compile comeonin` or update it with `mix deps.update comeonin`
** (ErlangError) erlang error: :enoent
(elixir) lib/system.ex:440: System.cmd("nmake", ["/F", "Makefile.win", "priv\\bcrypt_nif.dll"], [stderr_to_stdout: true])
mix.exs:15: Mix.Tasks.Compile.Comeonin.run/1
(elixir) lib/enum.ex:977: anonymous fn/3 in Enum.map/2
(elixir) lib/enum.ex:1261: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:977: Enum.map/2
(mix) lib/mix/tasks/compile.all.ex:15: Mix.Tasks.Compile.All.run/1
(mix) lib/mix/tasks/compile.ex:64: Mix.Tasks.Compile.run/1
(mix) lib/mix/tasks/deps.compile.ex:105: anonymous fn/2 in Mix.Tasks.Deps.Compile.do_mix/1
Attempt suggestions:
$ mix deps.compile comeonin
Results:
Running dependency resolution
Dependency resolution completed successfully
comeonin: v0.11.3
$ mix phoenix.server
Result: same error as above.
$ mix deps.update comeonin
Results:
==> comeonin
could not compile dependency comeonin, mix compile failed. You can recompile this dependency with `mix deps.compile comeonin` or update it with `mix deps.update comeonin`
** (ErlangError) erlang error: :enoent
(elixir) lib/system.ex:440: System.cmd("nmake", ["/F", "Makefile.win", "priv\\bcrypt_nif.dll"], [stderr_to_stdout: true])
mix.exs:15: Mix.Tasks.Compile.Comeonin.run/1
(elixir) lib/enum.ex:977: anonymous fn/3 in Enum.map/2
(elixir) lib/enum.ex:1261: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:977: Enum.map/2
(mix) lib/mix/tasks/compile.all.ex:15: Mix.Tasks.Compile.All.run/1
(mix) lib/mix/tasks/compile.ex:64: Mix.Tasks.Compile.run/1
(mix) lib/mix/tasks/deps.compile.ex:105: anonymous fn/2 in Mix.Tasks.Deps.Compile.do_mix/1
EDIT: After José Valim's suggestion I installed Visual Studio Express to get nmake. I also had to install a more recent version of erlang+otp from the erlang site. Finally, I'm now getting a different but still related error:
C:\Users\mesos_000\Desktop\elixir Projects\testeAddict>mix deps.compile comeonin
==> comeonin
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
'priv\bcrypt_nif.dll' is up-to-date
Compiled lib/comeonin/config.ex
Compiled lib/comeonin/pbkdf2_base64.ex
Compiled lib/comeonin/bcrypt_base64.ex
Compiled lib/comeonin/tools.ex
Compiled lib/comeonin.ex
Compiled lib/comeonin/password.ex
Compiled lib/comeonin/pbkdf2.ex
== Compilation error on file lib/comeonin/bcrypt.ex ==
** (MatchError) no match of right hand side value: {:error, :on_load_failure}
(stdlib) erl_eval.erl:669: :erl_eval.do_apply/6
could not compile dependency comeonin, mix compile failed. You can recompile this dependency with `mix deps.compile comeonin` or update it with `mix deps.update comeonin`
Also, installing erlang on my Ubuntu VM solved the problem there completely. The problem remains only in my Windows 8.1.
Upvotes: 2
Views: 529
Reputation: 1519
The instructions to solve the comeonin dependency error have been updated and I managed to solve this by doing what they said:
Open Developer Command Prompt for Visual Studio (in Windows 8, 8.1 and 10 it's located under the Visual Studio app menu).
$ cd "\Program Files (x86)\Microsoft Visual Studio 12.0\VC"
$ vcvarsall amd64
The comeonin dependency should now compile.
Upvotes: 2
Reputation: 51429
You need to install nmake. Quoting from another SO answer:
NMake is part of Microsoft's build tools for building C++ projects. You can get nmake as well as the MSVC++ compiler by downloading Visual C++ Express. Visual C++ Express runs perfectly fine on Windows 7.
Source: https://superuser.com/questions/146577/where-do-i-find-nmake-for-windows-7
Upvotes: 0