【发布时间】:2015-10-18 22:53:40
【问题描述】:
我尝试在我的 Phoenix 项目中安装 addict 包,但是我遇到了错误。 我在同事的 Mac 上尝试了完全相同的过程,他没有收到错误,而我在 Windows 上这样做。 该错误来自 comeonin 依赖项。我也在 Phoenix 0.14 和昨天发布的 0.15 更新中尝试过。
重建步骤:
-
创建一个新项目并运行它
$ mix phoenix.new testAddict $ cd testAddict $ mix ecto.create $ mix phoenix.server -
在 mix.exs 中添加 addict:
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 -
编译依赖:
$ mix deps.get
结果:
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)
-
再次运行 Phoenix 项目:
$ mix phoenix.server
结果(这里是错误):
==> 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
-
尝试建议:
$ mix deps.compile comeonin
结果:
Running dependency resolution
Dependency resolution completed successfully
comeonin: v0.11.3
$ mix phoenix.server
结果:与上述相同的错误。
$ mix deps.update comeonin
结果:
==> 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
编辑: 在 José Valim 的建议下,我安装了 Visual Studio Express 来获取 nmake。我还必须从 erlang 站点安装更新版本的 erlang+otp。 最后,我现在遇到了一个不同但仍然相关的错误:
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`
另外,在我的 Ubuntu VM 上安装 erlang 完全解决了那里的问题。问题只存在于我的 Windows 8.1 中。
【问题讨论】:
标签: compiler-errors packages elixir phoenix-framework