I'm trying to deploy a function on a remote Elixir node using Node.spawn/4 but I can't seem to manage it.
I have defined the function in question, (hello world), in a module Hello in iex and tried to deploy it using Node.spawn(:node2@remote, Hello, :world, []).
iex(node1@local) defmodule Hello do
...(node1@local) def world, do: IO.puts("Hello World)
...(node1@local) end
Node.spawn(:node2@remote, Hello, :world, [])
I would expect spawn/4 to send the module Hello over to the remote node so that the function world/0 is recognized there when trying to spawn it. However, I get the following error:
[error] Error in process #PID<16431.208.0> on node :node2@remote with exit value:
{:undef, [{Hello, :world, [], []}]}
Node.spawn(:node2@remote, Hello, :world, [[]])? - GavinBrelstaff