I frequently get this error during compilation. The only solution I’ve found is to manually delete the _build folder.
Full stack trace:
** (File.Error) could not remove files and directories recursively from "c:/apps/my_app/_build/dev/lib/argon2_elixir": not owner
(elixir 1.11.2) lib/file.ex:1290: File.rm_rf!/1
(mix 1.11.2) lib/mix/tasks/deps.compile.ex:81: anonymous fn/4 in Mix.Tasks.Deps.Compile.compile/2
(elixir 1.11.2) lib/enum.ex:1399: Enum."-map/2-lists^map/1-0-"/2
(elixir 1.11.2) lib/enum.ex:1399: Enum."-map/2-lists^map/1-0-"/2
(mix 1.11.2) lib/mix/tasks/deps.compile.ex:79: Mix.Tasks.Deps.Compile.compile/2
(mix 1.11.2) lib/mix/tasks/deps.loadpaths.ex:89: Mix.Tasks.Deps.Loadpaths.deps_check/2
(mix 1.11.2) lib/mix/tasks/deps.loadpaths.ex:28: Mix.Tasks.Deps.Loadpaths.run/1
(mix 1.11.2) lib/mix/task.ex:394: Mix.Task.run_task/3
The error does not always occur at the same location. In the above example, I got it while it was trying to remove argon2_elixir
but it can really be any folder.
I’m on Windows 10.
The only trend I’ve noticed is that I upgraded from Elixir 1.9.2 to 1.11.2 and this error has been happening much more frequently now — I’d say about 80-90% of the time. Previously, it was pretty rare.