问题
I'm connected to an Erlang node with -remsh. How do I modify the code path, in order to load a library that wasn't packaged into my release?
回答1:
All necessary functions to manipulate code loading, path... are in the code module (see doc at erlang otp code module).
You could add the system paths to the list by doing the following:
[code:add_pathz(P) || P <- filelib:wildcard("/usr/lib/erlang/lib/*/ebin")].
回答2:
After compiling some test code and connecting to a running node I was able to make it work with this:
(app@127.0.0.1)1> code:add_pathz("/path/to/my/compiled/beam").
(app@127.0.0.1)2> tester:hi().
hi!
ok
(app@127.0.0.1)3>
来源:https://stackoverflow.com/questions/22996117/how-do-i-modify-the-code-search-path-for-a-remote-erlang-node