(这里的新手)我试图运行牧场实例时出错了。通过rebar,我创建了应用程序和节点(请参见github)。但是,当我试图构建和运行它时,我得到了undef ranch,start_listener。
请参见完整的控制台输出:
$ rebar get-deps compile generate && sh rel/reverse/bin/reverse console
WARN: Expected reverse/deps/ranch to be an app dir (containing ebin/*.app), but no .app found.
==> rel (get-deps)
==> reverse (get-deps)
WARN: Expected reverse/deps/ranch to be an app dir (containing ebin/*.app), but no .app found.
Pulling ranch from {git,"git@github.com:ninenines/ranch.git",{tag,"1.1.0"}}
Cloning into 'ranch'...
==> ranch (get-deps)
==> ranch (compile)
Compiled src/ranch_transport.erl
Compiled src/ranch_sup.erl
Compiled src/ranch_ssl.erl
Compiled src/ranch_tcp.erl
Compiled src/ranch_protocol.erl
Compiled src/ranch_listener_sup.erl
Compiled src/ranch_app.erl
Compiled src/ranch_acceptors_sup.erl
Compiled src/ranch_acceptor.erl
Compiled src/ranch_server.erl
Compiled src/ranch.erl
Compiled src/ranch_conns_sup.erl
==> rel (compile)
==> reverse (compile)
Compiled src/reverse_sup.erl
Compiled src/reverse_app.erl
Compiled src/reverse_protocol.erl
==> rel (generate)
WARN: 'generate' command does not apply to directory reverse
Exec: reverse/rel/reverse/erts-6.3/bin/erlexec -boot reverse/rel/reverse/releases/1/reverse -mode embedded -config reverse/rel/reverse/releases/1/sys.config -args_file reverse/rel/reverse/releases/1/vm.args -- console
Root: reverse/rel/reverse
Erlang/OTP 17 [erts-6.3] [source-f9282c6] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V6.3 (abort with ^G)
(reverse@127.0.0.1)1>
=INFO REPORT==== 30-Dec-2014::22:47:08 ===
application: reverse
exited: {bad_return,
{{reverse_app,start,[normal,[]]},
{'EXIT',
{undef,
[{ranch,start_listener,
[reverse,10,ranch_tcp,
[{port,5555}],
reverse_protocol,[]],
[]},
{reverse_app,start,2,
[{file,"src/reverse_app.erl"},{line,13}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,272}]}]}}}}
type: permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,reverse,{bad_return,{{reverse_app,start,[normal,[]]},{'EXIT',{undef,[{ranch,start_listener,[reverse,10,ranch_tcp,[{port,5555}],reverse_protocol,[]],[]},{reverse_app,start,2,[{file,\"src/reverse_app.erl\"},{line,13}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,272}]}]}}}}}"}
Crash dump was written to: erl_crash.dump我不确定我是否正确地将ranch添加到reltool.config (请看github)中。但是如果我将deps从libs_dir路径中删除,我将得到rebar generate错误Application version clash. Multiple directories contain version ...。
更新如果我删除并运行失败呼叫,application:which_applications().会给出{ranch,[],[]}作为运行中的一个。
更新版本
$ erl
Erlang/OTP 17 [erts-6.3] [source-f9282c6] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
$ rebar --version
rebar 2.5.1 17 20141223_141030 git 2.5.1-84-gdd9125e我做错什么了?
提前感谢!
发布于 2014-12-31 10:07:32
在reltool.config中,从牧场的路径中删除ebin目录:
{app, ranch, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/ranch/"}]}如果您有大量的依赖项,那么这样做更方便:
{lib_dirs, ["../deps"]}而不是为每个依赖项拥有一个单独的{app, <dep_name>, [...]}。
Application version clash. Multiple directories contain version XXX错误表示已经安装了Ranch应用程序,可能是在Erlang目录中,与Rebar下载的deps版本产生了冲突。
https://stackoverflow.com/questions/27712698
复制相似问题