I have an umbrella app where I am making a build for windows using bakeware: https://github.com/bake-bake-bake/bakeware
I have followed the normal setup for windows:
choco install -y zstandard make mingw
I have installed elixir and erlang otp via their official website installers:
I am able to run and do everything normally, but my VSCode marks my mix.exs
file as a huge red error 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
In Bakeware's page there is a section:
Change the default
MAKE
environment variable used byelixir_make
fromnmake
tomake
(set it permanently to get rid of the errors in VSCode)
The elixir_make
docs say to set the make_executable
in your mix.exs
to the make
command installed on the system.
And then in your shell, either set the environment variables the Windows Way (If you already set the environment variables but they aren't taking, you may need to restart your terminal or VS Code), or if you're using bash
, you can put them in your .bash_profile
as the bakeware
docs show.
Command Prompt:
set MAKE=make
set CC=gcc
or MinGW
export MAKE=make
export CC=gcc
mix release
I was able to somehow fix the issue. Bakeware, the dependency, really likes Powershell. But not any powershell. A powershell with admin rights. To get rid of the warning one must perform the following steps while VSCode is closed :
$env:CC="gcc"
$env:MAKE="make"
MIX_ENV
to something. It doesnt have to be prod
, but since powershell does not set this value by default, you have to manually set it yourself. Before running tests, fetching dependencies or anything.mix deps.get
After this, if you still get the red wall of death, trying deleting your .elixir_ls
folder to force to go again. Then open VSCode with code.
Hope it works for you, it did for me. Trying this with any other terminal will result in seeing the red wall of death. According to my experiments, powershell is the only that works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.