Compiler errors Windows上的Addict hex程序包依赖项错误在Mac上未发生

Compiler errors Windows上的Addict hex程序包依赖项错误在Mac上未发生,compiler-errors,packages,elixir,phoenix-framework,Compiler Errors,Packages,Elixir,Phoenix Framework,我尝试在我的凤凰城项目中安装该软件包,但是我遇到了一个错误。 我在一位同事的Mac电脑上尝试了完全相同的过程,他没有得到错误,而我在Windows上得到了错误。 错误来自comeonin依赖项。我也在Phoenix 0.14和昨天发布的0.15更新中尝试过 重新创建的步骤: 创建一个新项目并运行它 $ mix phoenix.new testAddict $ cd testAddict $ mix ecto.create $ mix phoenix.server 在mix.exs中添加瘾君子

我尝试在我的凤凰城项目中安装该软件包,但是我遇到了一个错误。 我在一位同事的Mac电脑上尝试了完全相同的过程,他没有得到错误,而我在Windows上得到了错误。 错误来自comeonin依赖项。我也在Phoenix 0.14和昨天发布的0.15更新中尝试过

重新创建的步骤:

  • 创建一个新项目并运行它

    $ mix phoenix.new testAddict
    $ cd testAddict
    $ mix ecto.create
    $ mix phoenix.server
    
  • 在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
    
  • 编译依赖项:

    $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)
    
    Running dependency resolution
    Dependency resolution completed successfully
      comeonin: v0.11.3
    $ mix phoenix.server
    
    ==> 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
    
  • 再次运行Phoenix项目:

    $mix phoenix.server

  • 结果(以下是错误):

  • 尝试建议:

    $mix deps.compile comeonin

  • 结果:

    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)
    
    Running dependency resolution
    Dependency resolution completed successfully
      comeonin: v0.11.3
    $ mix phoenix.server
    
    ==> 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.update comeonin
    
    结果:

    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)
    
    Running dependency resolution
    Dependency resolution completed successfully
      comeonin: v0.11.3
    $ mix phoenix.server
    
    ==> 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虚拟机上安装erlang完全解决了这个问题。此问题仅在我的Windows 8.1中存在。

    您需要安装nmake。引用另一个SO的回答:

    nFube是微软构建C++项目的构建工具的一部分。您可以通过下载获得nmake以及MSVC++编译器。Visual C++快照在Windows 7上运行非常精细。


    来源:

    解决comeonin依赖性错误的说明已经更新,我按照他们的说法设法解决了这个问题:

    打开Visual Studio的开发者命令提示符(在Windows 8、8.1和10中,它位于Visual Studio应用程序菜单下)


    comeonin依赖项现在应该可以编译了。

    我同时安装了Visual Studio Express和Ultimate,但它不起作用。我使用的是Windows 8.1。如果启动一个命令并键入“nmake”,会得到什么?
    C:\Users\mesos\u 000>nmake“nmake”不被识别为内部或外部命令,可操作的程序或批处理文件。
    我刚在/VC/bin/nmake.exe下的Visual Studio文件夹中找到它,但运行它并没有设置它。我得到
    nmake:致命错误U1064:找不到MAKEFILE,也没有指定目标停止。
    我使用Visual Studio Express 2015完成了此操作。我必须更改安装以确保安装C++工具。本例中的路径是
    C:\ProgramFiles(x86)\Microsoft Visual Studio 14.0\VC