Hologram js deps install failing with :eaccess to npm.cmd

Hello, I am trying to run a Hologram project but whenever I run mix phx.server or mix setup I’m getting the following error right after the Hologram: compiler started log:

** (ErlangError) Erlang error: :eacces
    erlang.erl:4716: :erlang.open_port({:spawn_executable, ~c"c:/Program Files/nodejs/npm.cmd"}, [{:cd, "c:/[my path]/hologram_example/deps/hologram/assets"}, :use_stdio, :exit_status, :binary, :hide, {:args, ["install"]}])
    (elixir 1.16.2) lib/system.ex:1116: System.do_cmd/3
    (hologram 0.5.1) lib/hologram/compiler.ex:366: Hologram.Compiler.install_js_deps/2
    (hologram 0.5.1) lib/mix/tasks/compile/hologram.ex:48: Mix.Tasks.Compile.Hologram.run/1
    (mix 1.16.2) lib/mix/task.ex:478: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.16.2) lib/mix/tasks/compile.all.ex:124: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.16.2) lib/mix/tasks/compile.all.ex:104: Mix.Tasks.Compile.All.compile/4
    (mix 1.16.2) lib/mix/tasks/compile.all.ex:93: Mix.Tasks.Compile.All.with_logger_app/2

This happens both when creating a project and when cloning one from github. I tried multiple things such as running as admin, changing permissions to the npm.cmd file / its containing folder, and manually running npm install in the assets folder (which worked but didn’t fix the error).
If it matters, I’m using windows 10.

Is there a way to solve this? Thank you :slight_smile:

1 Like

Hey, thanks for reporting this!

What most probably happened is that Hologram wasn’t properly detecting npm executable on Windows systems where it’s installed as npm.cmd.

I’ve updated the code to automatically detect the correct executable.

Since I don’t have a Windows machine to verify this myself, could you try using this specific commit version in your mix.exs?

{:hologram, git: "https://github.com/bartblast/hologram.git", ref: "800c0505a50138b391ca90e3aa45b823be8459ab"}

Then run mix deps.update hologram and try mix phx.server again, and let me know if this fixes the issue, thanks!

Tried this, couldn’t get Hologram to even install :frowning: got the following error:

* Updating hologram (https://github.com/bartblast/hologram.git - 800c0505a50138b391ca90e3aa45b823be8459ab)
error: invalid path 'benchmarks/elixir/reflection/elixir_module?_1/README.md'
error: invalid path 'benchmarks/elixir/reflection/elixir_module?_1/run.exs'
error: invalid path 'benchmarks/elixir/reflection/erlang_module?_1/README.md'
error: invalid path 'benchmarks/elixir/reflection/erlang_module?_1/run.exs'
error: invalid path 'benchmarks/elixir/reflection/has_function?_3/README.md'
error: invalid path 'benchmarks/elixir/reflection/has_function?_3/run.exs'
error: invalid path 'benchmarks/elixir/reflection/has_struct?_1/README.md'
error: invalid path 'benchmarks/elixir/reflection/has_struct?_1/run.exs'
error: invalid path 'benchmarks/elixir/reflection/module?_1/README.md'
error: invalid path 'benchmarks/elixir/reflection/module?_1/run.exs'
** (Mix) Command "git --git-dir=.git checkout --quiet 800c0505a50138b391ca90e3aa45b823be8459ab" failed

Also a similar error happened when I tried to git clone the repo.
Regardless, tried downloading it directly and putting it in as a local dependency - got the same error from before.

Also, I’m not sure that that’s the case - wouldn’t it be :enoent if it couldn’t find the file? AFAIK :eacces happens with file permission problems (although I could be wrong)

Yeah, it may be some permissions issue…

The path errors you’re seeing are probably because Windows doesn’t allow question marks in file names - those benchmark files with ? characters can’t be checked out on Windows. I’ll have to update the file names.

What versions of Elixir and Erlang are you running? I’ll boot up Windows 10 through UTM to reproduce and debug this properly.

Thank you :slight_smile:
And I’m running Elixir 1.16.2 and Erlang 26