[英]VScode mix.exs error - Could not compile with “make”
我有一个伞式应用程序,我正在使用烤盘为 windows 构建: https://github.com/bake-bake-bake/bakeware
我遵循了 windows 的正常设置:
choco install -y zstandard make mingw
我已经通过他们的官方网站安装程序安装了 elixir 和 erlang otp:
我能够正常运行和执行所有操作,但我的 VSCode 将我的mix.exs
文件标记为一个巨大的红色错误 blob:
an exception was raised:
** (Mix.Error) Could not compile with "make" (exit status: 2).
(mix 1.13.1) lib/mix.ex:515: Mix.raise/2
(elixir_make 0.6.3) lib/mix/tasks/compile.make.ex:154: Mix.Tasks.Compile.ElixirMake.run/1
(mix 1.13.1) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
(mix 1.13.1) lib/mix/tasks/compile.all.ex:92: Mix.Tasks.Compile.All.run_compiler/2
(mix 1.13.1) lib/mix/tasks/compile.all.ex:72: Mix.Tasks.Compile.All.compile/4
(mix 1.13.1) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
(mix 1.13.1) lib/mix/tasks/compile.all.ex:36: Mix.Tasks.Compile.All.run/1
(mix 1.13.1) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3ElixirLS
在 Bakeware 的页面中有一个部分:
将
elixir_make
使用的默认MAKE
环境变量从nmake
更改为make
(永久设置以消除 VSCode 中的错误)
elixir_make
文档说将make_executable
中的mix.exs
设置为系统上安装的make
命令。
然后在您的 shell 中,以Windows 方式设置环境变量(如果您已经设置了环境变量但没有使用,您可能需要重新启动终端或 VS Code),或者如果您使用的是bash
可以将它们放在您的.bash_profile
中,如bakeware
文档所示。
命令提示符:
set MAKE=make
set CC=gcc
或 MinGW
export MAKE=make
export CC=gcc
mix release
我能够以某种方式解决这个问题。 Bakeware,依赖,真的很喜欢 Powershell。 但不是任何 powershell。 具有管理员权限的 powershell。 要消除警告,必须在 VSCode关闭时执行以下步骤:
$env:CC="gcc"
$env:MAKE="make"
MIX_ENV
设置为某个值。 它不一定是prod
,但由于 powershell 默认不设置此值,您必须自己手动设置。 在运行测试之前,获取依赖项或任何东西。mix deps.get
在此之后,如果您仍然获得死亡红墙,请尝试删除您的.elixir_ls
文件夹以再次强制到 go。 然后用code.
希望它对你有用,它对我有用。 用任何其他终端尝试此操作将导致看到红色的死亡之墙。 根据我的实验,powershell 是唯一有效的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.