简体   繁体   English

我的Erlang应用程序看不到牧场模块依赖性

[英]My Erlang application don't see ranch module dependency

(Newbie here) I am having an error when trying to run ranch example . (这里是新手)尝试运行牧场示例时出现错误。 Via rebar I created application and node (please see on github ). 通过rebar我创建了应用程序和节点(请参见github上 )。 But when I am trying to build and run it I am getting undef ranch,start_listener . 但是,当我尝试构建和运行它时,我得到的是undef ranch,start_listener

Please see full console output: 请查看完整的控制台输出:

$ 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

I am not sure I correctly added ranch to reltool.config ( please see on github ). 我不确定我是否将ranch正确地添加到reltool.config请参见github上 )。 But If I remove deps from libs_dir path I will get rebar generate error Application version clash. Multiple directories contain version ... 但是,如果我从libs_dir路径中删除deps ,我将得到rebar generate错误Application version clash. Multiple directories contain version ... Application version clash. Multiple directories contain version ... . Application version clash. Multiple directories contain version ...

UPDATE if I remove failing call and run it, application:which_applications(). UPDATE如果我删除失败的通话并运行它, application:which_applications(). gives me {ranch,[],[]} as one of the running ones. 给我{ranch,[],[]}作为跑步者之一。

UPDATE versions 更新版本

$ 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

What I am doing wrong? 我做错了什么?

Thanks in advance! 提前致谢!

In the reltool.config , remove the ebin directory from the path to Ranch: reltool.config ,从Ranch的路径中删除ebin目录:

{app, ranch, [{mod_cond, app}, {incl_cond, include}, {lib_dir, "../deps/ranch/"}]}

If you have lots of dependencies it's more convenient to do: 如果您有很多依赖关系,这样做会更方便:

{lib_dirs, ["../deps"]}

instead of having a separate {app, <dep_name>, [...]} for each dependency. 而不是每个依赖项都有单独的{app, <dep_name>, [...]}

The Application version clash. Multiple directories contain version XXX Application version clash. Multiple directories contain version XXX Application version clash. Multiple directories contain version XXX error indicates that the Ranch application is already installed, probably in the Erlang lib directory, creating conflicts with the deps version downloaded by Rebar. Application version clash. Multiple directories contain version XXX错误,表明Ranch应用程序已安装(可能在Erlang lib目录中),与Rebar下载的deps版本产生冲突。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM