chernyshof / react-phoenix-users-boilerplate

Elixir/Phoenix + React + users template/boilerplate.
https://phxboilerplate.herokuapp.com/
MIT License
71 stars 11 forks source link

eaccess : erlang.open_port spawn executable -> C:/Program Files/nodejs/npm.cmd #6

Closed baskint closed 7 years ago

baskint commented 7 years ago

First of all, thanks so much making this boiler plate code available. I have followed the instructions and got the app to work on my Ubuntu box and pushed it to heroku.

However, having issues on Windows system (I know that is a bit afterthought), I am thinking somewhere the pipe specific to windows, we are building the directories. I suspect either the spaces in the path or lacck of back slashes in the path is causing this error. Any thoughts where I could fix this?

s:\src\test\mix phx.server

[info] Running TestWeb.Endpoint with Cowboy using http://0.0.0.0:4000
[error] Task #PID<0.354.0> started from WhitakerHomeWeb.Endpoint terminating
** (stop) :eacces
    :erlang.open_port({:spawn_executable, 'c:/Program Files/nodejs/npm.cmd'}, [{:cd, "s:/src/test/assets"}, :stderr_to_stdout, :use_stdio, :exit_status, :binary, :hide, {:args, ["run", "start"]}])
    (elixir) lib/system.ex:611: System.cmd/3
    (phoenix) lib/phoenix/endpoint/watcher.ex:15: Phoenix.Endpoint.Watcher.watch/3
    (elixir) lib/task/supervised.ex:85: Task.Supervised.do_apply/2
    (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Function: &Phoenix.Endpoint.Watcher.watch/3
    Args: ["npm", ["run", "start"], [cd: "s:/src/test/assets"]]
[error] Task #PID<0.355.0> started from TestWeb.Endpoint terminating
** (stop) :eacces
    :erlang.open_port({:spawn_executable, 'c:/Program Files/nodejs/npm.cmd'}, [{:cd, "s:/src/test/assets"}, :stderr_to_stdout, :use_stdio, :exit_status, :binary, :hide, {:args, ["run", "start"]}])
    (elixir) lib/system.ex:611: System.cmd/3

Thank you for any ideas.

chernyshof commented 7 years ago

Thanks for the report and sorry for late reply. It's caused by weird npm permission issue on windows. You can simply replace line in config/dev.exs from this watchers: [npm: ["run", "start", cd: Path.expand("../assets", __DIR__)]]

to this watchers: [node: ["node_modules/webpack-dev-server/bin/webpack-dev-server.js", "--colors", "--stdin", cd: Path.expand("../assets", __DIR__)]]

I will fix this in the next commit. Please close issue if now it works. Let me know if it didn't work out for you.

baskint commented 7 years ago

It worked out great. I made the changes on Windows machine and pushed, and pulled it on Ubuntu. Confirm that it works on Ubuntu was well. It sure is weird. I was thinking it was something with the paths, but it was not. Thank you for the fix. Cheers! 🎊