0

我已经关注了http://maplekeycompany.blogspot.in/2012/03/very-basic-cowboy-setup.html链接,但是当我运行这个项目时,它显示我的崩溃报告告诉我牛仔 start_listener() 是未定义的。

=CRASH REPORT==== 12-Aug-2014::10:08:06 ===
  crasher:
    initial call: simple_server_http:init/1
    pid: <0.66.0>
    registered_name: []
    exception exit: {undef,
                     [{cowboy,start_listener,
                       [http,16,cowboy_tcp_transport,
                        [{port,8082}],
                        cowboy_http_protocol,
                        [{dispatch,
                          [{'_',
                            [{[],simple_server_http_static,
                              [<<"html">>,<<"index.html">>]},
                             {'_',simple_server_http_catchall,[]}]}]}]],
                       []},
                      {simple_server_http,init,1,
                       [{file,"src/simple_server_http.erl"},{line,45}]},
                      {gen_server,init_it,6,
                       [{file,"gen_server.erl"},{line,306}]},
                      {proc_lib,init_p_do_apply,3,
                       [{file,"proc_lib.erl"},{line,239}]}]}
      in function  gen_server:init_it/6 (gen_server.erl, line 330)
    ancestors: [simple_server_sup,<0.64.0>]
    messages: []
    links: [<0.65.0>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 610
    stack_size: 27
    reductions: 913
  neighbours:

=SUPERVISOR REPORT==== 12-Aug-2014::10:08:06 ===
     Supervisor: {local,simple_server_sup}
     Context:    start_error
     Reason:     {undef,
                  [{cowboy,start_listener,
                    [http,16,cowboy_tcp_transport,
                     [{port,8082}],
                     cowboy_http_protocol,
                     [{dispatch,
                       [{'_',
                         [{[],simple_server_http_static,
                           [<<"html">>,<<"index.html">>]},
                          {'_',simple_server_http_catchall,[]}]}]}]],
                    []},
                   {simple_server_http,init,1,
                    [{file,"src/simple_server_http.erl"},{line,45}]},
                   {gen_server,init_it,6,[{file,"gen_server.erl"},{line,306}]},
                   {proc_lib,init_p_do_apply,3,
                    [{file,"proc_lib.erl"},{line,239}]}]}
     Offender:   [{pid,undefined},
                  {name,simple_server_http},
                  {mfargs,{simple_server_http,start_link,[]}},
                  {restart_type,permanent},
                  {shutdown,5000},
                  {child_type,worker}]

这个错误意味着什么以及如何解决它?

4

1 回答 1

1

此错误消息表明模块 simple_server_http 在第 45 行调用的函数 cowboy:start_listener/6 不存在。我在github上查了cowboy模块的代码源,这个函数是不存在的,真的。所以博客中的代码没有机会在当前版本的牛仔上运行。

由于它指定使用已过时的 erlang 版本 R15B(2011 年 12 月),也许您可​​以查看以前的牛仔版本:0.6.0 版本提供了此功能-> 从 github 获取源代码

于 2014-08-12T06:13:04.493 回答