Make use of -emu_args
flag which will show exact arguments sent to the emulator. Here is a simple sample to play with:
$ cat test.args
-emu_args
-pa deps/*/ebin
-pa ebin
-name test@localhost
Now for once I will pass all these arguments manually:
$ erl -emu_args -pa deps/*/ebin -pa ebin -name test@localhost
Executing: /Users/abhinavsingh/Builds/R15B03/lib/erlang/erts-5.9.3.1/bin/beam.smp /Users/abhinavsingh/Builds/R15B03/lib/erlang/erts-5.9.3.1/bin/beam.smp -- -root /Users/abhinavsingh/Builds/R15B03/lib/erlang -progname erl -- -home /Users/abhinavsingh -- -pa deps/cowboy/ebin deps/jsx/ebin deps/lager/ebin deps/mimetypes/ebin deps/ranch/ebin -pa ebin -name test@localhost
Erlang R15B03 (erts-5.9.3.1) [source] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.3.1 (abort with ^G)
(test@localhost)1>
Next via args file:
$ erl -args_file test.args
Executing: /Users/abhinavsingh/Builds/R15B03/lib/erlang/erts-5.9.3.1/bin/beam.smp /Users/abhinavsingh/Builds/R15B03/lib/erlang/erts-5.9.3.1/bin/beam.smp -- -root /Users/abhinavsingh/Builds/R15B03/lib/erlang -progname erl -- -home /Users/abhinavsingh -- -pa deps/*/ebin -pa ebin -name test@localhost
Erlang R15B03 (erts-5.9.3.1) [source] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.3.1 (abort with ^G)
(test@localhost)1>
As you can see, both are really not the same. Specifically, while doing it all manually -pa deps/*/ebin
expands into -pa deps/cowboy/ebin deps/jsx/ebin ...
, but the same doesn't go down well when you pass it via args file. As as result, certain modules are not in your code path and thus application fails to start.