【问题标题】:argon2 elixir compilation issue while mix ecto.create混合 ecto.create 时出现 argon2 elixir 编译问题
【发布时间】:2023-03-03 08:00:24
【问题描述】:

在运行 mix ecto.create 创建 postgres 数据库时出现以下错误。

==> 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.

我在apps文件夹下的mix.exs文件中定义如下:

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

尝试按照错误消息中的建议重新编译包,但没有任何帮助。

感谢您在这方面的帮助。

【问题讨论】:

  • 检查 ˋnmakeˋ 是否在您的路径上。如果没有,请添加它或正确定义ˋMAKEˋ环境变量。
  • 我检查过 - 它已经添加到环境变量的 PATH 中。路径是 C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\nmake.exe
  • 如果你没有正确定义环境变量(例如 %INCLUDE%),nmake 是否在路径中并不重要。 nmake 使用这些环境变量来查找它需要的文件。鉴于下面的答案,我想说您应该在尝试运行 mix 之前简单地构建一个设置这些变量的 .cmd 文件。

标签: erlang elixir phoenix-framework


【解决方案1】:

您似乎没有安装nmake。我猜你在Windows上?以一种或另一种方式安装nmake,例如this answer

【讨论】:

  • nmake 已安装。我什至在 Visual Studio 命令 shell 中运行了 nmake.exe /F MAKEFILE 命令,没有任何问题。是的,我在 WIN 10 中。
【解决方案2】:

我终于能够解决它。这是解决问题的一般方法,无论您遇到什么具体问题。

首先,我从 Visual Studio 文件夹 C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\Hostx64\x64\ 中复制了 nmake.exe 并粘贴到 System32 文件夹中。运行命令mix ecto.create 并收到一个更改的详细错误,解决了该问题。这是错误的输出: ** (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`。

安装 Visual C++ Build Tools 后,查看“Program Files (x86)” 目录并搜索“Microsoft Visual Studio”。记下完整路径 版本号最高的文件夹。打开“运行”命令并 输入以下命令(确保路径和版本号 是正确的):

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

这应该会打开一个带有必要环境变量的命令提示符 设置,您将能够从中运行“混合编译”、“混合 deps.compile”、 和“混合测试”命令。`

逐行遵循,成功就在您的脚下。 :)

【讨论】:

    猜你喜欢
    • 2017-10-01
    • 2014-10-11
    • 2016-12-24
    • 1970-01-01
    • 2020-06-21
    • 2015-04-27
    • 1970-01-01
    • 2017-11-05
    • 1970-01-01
    相关资源
    最近更新 更多