内核 pid 终止应用程序启动失败,bad_return
Kernel pid terminated application start failure, bad_return
我写了一个牛仔项目,我在 gmake run
的本地主机上启动。
当我 make run
进行全新安装时,出现此错误:
~/tunnel# make run
erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
make[1]: Entering directory `/root/tunnel/deps/cowboy'
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
make[2]: Entering directory `/root/tunnel/deps/cowlib'
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
make[2]: Leaving directory `/root/tunnel/deps/cowlib'
make[2]: Entering directory `/root/tunnel/deps/ranch'
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
make[2]: Leaving directory `/root/tunnel/deps/ranch'
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
GEN rebar.config
make[1]: Leaving directory `/root/tunnel/deps/cowboy'
make[1]: Entering directory `/root/tunnel/deps/jiffy'
./rebar compile
==> jiffy (compile)
make[1]: Leaving directory `/root/tunnel/deps/jiffy'
DEPEND tunnel.d
erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
ERLC tunnel_app.erl
APP tunnel
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/root/tunnel/ebin
/root/tunnel/deps
/usr/local/lib/erlang/lib
/root/tunnel/apps
/root/tunnel/_rel
===> Resolved tunnel_release-1
===> Including Erts from /usr/local/lib/erlang
===> release successfully created!
===> tarball /root/tunnel/_rel/tunnel_release/tunnel_release-1.tar.gz successfully created!
Exec: /root/tunnel/_rel/tunnel_release/erts-9.0/bin/erlexec -boot /root/tunnel/_rel/tunnel_release/releases/1/tunnel_release -mode embedded -boot_var ERTS_LIB_DIR /root/tunnel/_rel/tunnel_release/erts-9.0/../lib -config /root/tunnel/_rel/tunnel_release/releases/1/sys.config -args_file /root/tunnel/_rel/tunnel_release/releases/1/vm.args -- console
Root: /root/tunnel/_rel/tunnel_release
/root/tunnel/_rel/tunnel_release
heart_beat_kill_pid = 16083
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [kernel-poll:false]
=INFO REPORT==== 29-Sep-2017::11:46:35 ===
application: tunnel
exited: {bad_return,
{{tunnel_app,start,[normal,[]]},
{'EXIT',
{undef,
[{cowboy,start_clear,
[my_http_listener,100,
[{port,8080}],
#{env =>
#{dispatch =>
[{'_',[],
[{[<<"info">>],[],lobby_handler,[]},
{[<<"join">>,name],[],join_handler,[]},
{[<<"player">>,<<"status">>,name],
[],player_status_handler,[]},
{[<<"tables">>,<<"info">>,table_id],
[],table_info_handler,[]},
{[<<"tables">>,<<"play">>,table_id,name,auth,
action,x,y],
[],table_play_handler,[]},
{[<<"assets">>,'...'],
[],cowboy_static,
{dir,"/root/tunnel/static/assets/"}}]}]}}],
[]},
{tunnel_app,start,2,[{file,"src/tunnel_app.erl"},{line,17}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},{line,273}]}]}}}}
type: permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,tunnel,{bad_return,{{tunnel_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_clear,[my_http_listener,100,[{port,8080}],#{env => #{dispatch => [{'_',[],[{[<<\"info\">>],[],lobby_handler,[]},{[<<\"join\">>,name],[],join_handler,[]},{[<<\"player\">>,<<\"status\">>,name],[],player_status_handler,[]},{[<<\"tables\">>,<<\"info\">>,table_id],[],table_info_handler,[]},{[<<\"tables\">>,<<\"play\">>,table_id,name,auth,action,x,y],[],table_play_handler,[]},{[<<\"assets\">>,'...'],[],cowboy_static,{dir,\"/root/tunnel/static/assets/\"}}]}]}}],[]},{tunnel_app,start,2,[{file,\"src/tunnel_app.erl\"},{line,17}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,tunnel,{bad_return,{{tunnel_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_clear,[my_http_listener,100,[{port,8080}],#{
heart: Fri Sep 29 11:46:36 2017: Erlang is crashing .. (waiting for crash dump file)
heart: Fri Sep 29 11:46:36 2017: Would reboot. Terminating.
make: *** [run] Error 1
我认为 tunnel_app
不好 return
这是我的tunnel_app.erl
-module(tunnel_app).
-behaviour(application).
-export([start/2]).
-export([stop/1]).
start(_Type, _Args) ->
Dispatch = cowboy_router:compile([
{'_', [
{"/info", lobby_handler, []},
{"/join/:name", join_handler, []},
{"/player/status/:name", player_status_handler, []},
{"/tables/info/:table_id", table_info_handler, []},
{"/tables/play/:table_id/:name/:auth/:action/:x/:y", table_play_handler, []},
{"/assets/[...]", cowboy_static, {dir, "/users/quantum/tunnel/static/assets/"}}
]}]),
{ok, _} = cowboy:start_clear(my_http_listener, 100,
[{port, 8080}],
#{env => #{dispatch => Dispatch}}),
{ok, MainDoor} = door:go(),
register(main_door, MainDoor),
{ok, MainRoom} = room:go(),
register(main_room, MainRoom),
tunnel_sup:start_link().
stop(_State) ->
ok.
和它用 start_link
调用的 tunnel_sup.erl
:
-module(tunnel_sup).
-behaviour(supervisor).
-export([start_link/0]).
-export([init/1]).
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
Procs = [],
{ok, {{one_for_one, 1, 5}, Procs}}.
我检查了我的 .gitignore
.erlang.mk/
*.beam
src/*.beam
_rel/
deps/
ebin/
完整的存储库在这里:https://github.com/quantumproductions/tunnel
我可以在我的机器上复制一个文件夹并且它可以工作。当我上传到 github 并下载它时,运行 失败。
~/tunnel3/ls
Makefile deps erlang.mk rel src tunnel.d
_rel ebin oldh relx.config static
~/tdep/ls
Makefile deps erlang.mk rel src tunnel.d
_rel ebin oldh relx.config static
第二个失败:
~/tdep/gmake run
Error: No Makefile to build dependency /Users/quantum/tdep/deps/cowboy.
gmake: *** [erlang.mk:4182: deps] Error 2
第一个文件夹工作正常
/tunnel3/gmake run
gmake[1]: Entering directory '/Users/quantum/tunnel3/deps/cowboy'
gmake[2]: Entering directory '/Users/quantum/tunnel3/deps/cowlib'
gmake[2]: Leaving directory '/Users/quantum/tunnel3/deps/cowlib'
gmake[2]: Entering directory '/Users/quantum/tunnel3/deps/ranch'
gmake[2]: Leaving directory '/Users/quantum/tunnel3/deps/ranch'
GEN rebar.config
gmake[1]: Leaving directory '/Users/quantum/tunnel3/deps/cowboy'
gmake[1]: Entering directory '/Users/quantum/tunnel3/deps/jiffy'
CC=gcc ./enc compile
gmake -f c_src/Makefile.erlang.mk
gmake[2]: Entering directory '/Users/quantum/tunnel3/deps/jiffy'
gmake[2]: Nothing to be done for 'all'.
gmake[2]: Leaving directory '/Users/quantum/tunnel3/deps/jiffy'
gmake[1]: Leaving directory '/Users/quantum/tunnel3/deps/jiffy'
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/Users/quantum/tunnel3/ebin
/Users/quantum/tunnel3/deps
/usr/local/Cellar/erlang/19.2/lib/erlang/lib
/Users/quantum/tunnel3/apps
/Users/quantum/tunnel3/_rel
什么配置可能导致此问题?
编辑:
Juanjo Martin 的回答有效,在我克隆的文件夹中。
在我的原始文件夹中,它没有,删除 100 参数得到以下结果。
为什么这在 1 个特定文件夹中不起作用?我必须 check/make 修复什么样的环境才能防止这种情况发生?好像 ~/tunnel
是 运行 不同版本的牛仔?
/tunnel/gmake run
gmake[1]: Entering directory '/Users/quantum/tunnel/deps/cowboy'
gmake[2]: Entering directory '/Users/quantum/tunnel/deps/cowlib'
gmake[2]: Leaving directory '/Users/quantum/tunnel/deps/cowlib'
gmake[2]: Entering directory '/Users/quantum/tunnel/deps/ranch'
gmake[2]: Leaving directory '/Users/quantum/tunnel/deps/ranch'
GEN rebar.config
gmake[1]: Leaving directory '/Users/quantum/tunnel/deps/cowboy'
gmake[1]: Entering directory '/Users/quantum/tunnel/deps/jiffy'
CC=gcc ./enc compile
gmake -f c_src/Makefile.erlang.mk
gmake[2]: Entering directory '/Users/quantum/tunnel/deps/jiffy'
gmake[2]: Nothing to be done for 'all'.
gmake[2]: Leaving directory '/Users/quantum/tunnel/deps/jiffy'
gmake[1]: Leaving directory '/Users/quantum/tunnel/deps/jiffy'
DEPEND tunnel.d
ERLC tunnel_app.erl
APP tunnel
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/Users/quantum/tunnel/ebin
/Users/quantum/tunnel/deps
/usr/local/Cellar/erlang/19.2/lib/erlang/lib
/Users/quantum/tunnel/apps
/Users/quantum/tunnel/_rel
===> Resolved tunnel_release-1
===> Including Erts from /usr/local/Cellar/erlang/19.2/lib/erlang
===> release successfully created!
===> tarball /Users/quantum/tunnel/_rel/tunnel_release/tunnel_release-1.tar.gz successfully created!
Exec: /Users/quantum/tunnel/_rel/tunnel_release/erts-8.2/bin/erlexec -boot /Users/quantum/tunnel/_rel/tunnel_release/releases/1/tunnel_release -mode embedded -boot_var ERTS_LIB_DIR /Users/quantum/tunnel/_rel/tunnel_release/erts-8.2/../lib -config /Users/quantum/tunnel/_rel/tunnel_release/releases/1/sys.config -args_file /Users/quantum/tunnel/_rel/tunnel_release/releases/1/vm.args -- console
Root: /Users/quantum/tunnel/_rel/tunnel_release
/Users/quantum/tunnel/_rel/tunnel_release
heart_beat_kill_pid = 3135
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
=INFO REPORT==== 5-Oct-2017::16:54:36 ===
application: tunnel
exited: {bad_return,
{{tunnel_app,start,[normal,[]]},
{'EXIT',
{undef,
[{cowboy,start_clear,
[my_http_listener,
[{port,8080}],
#{env => #{dispatch => [{'_',[],
[{[<<"info">>],[],lobby_handler,[]},
{[<<"join">>,name],
[],join_handler,[]},
{[<<"player">>,<<"status">>,name],
[],player_status_handler,[]},
{[<<"tables">>,<<"info">>,table_id],
[],table_info_handler,[]},
{[<<"tables">>,<<"play">>,table_id,
name,auth,action,x,y],
[],table_play_handler,[]},
{[<<"assets">>,'...'],
[],cowboy_static,
{dir,
"/users/quantum/tunnel/static/assets/"}}]}]}}],
[]},
{tunnel_app,start,2,
[{file,"src/tunnel_app.erl"},{line,17}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,273}]}]}}}}
type: permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,tunnel,{bad_return,{{tunnel_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_clear,[my_http_listener,[{port,8080}],#{env => #{dispatch => [{'_',[],[{[<<\"info\">>],[],lobby_handler,[]},{[<<\"join\">>,name],[],join_handler,[]},{[<<\"player\">>,<<\"status\">>,name],[],player_status_handler,[]},{[<<\"tables\">>,<<\"info\">>,table_id],[],table_info_handler,[]},{[<<\"tables\">>,<<\"play\">>,table_id,name,auth,action,x,y],[],table_play_handler,[]},{[<<\"assets\">>,'...'],[],cowboy_static,{dir,\"/users/quantum/tunnel/static/assets/\"}}]}]}}],[]},{tunnel_app,start,2,[{file,\"src/tunnel_app.erl\"},{line,17}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,tunnel,{bad_return,{{tunnel_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_clear,[my_http_listener,[{port,8080}],#{env
heart: Thu Oct 5 16:54:37 2017: Erlang is crashing .. (waiting for crash dump file)
heart: Thu Oct 5 16:54:37 2017: Would reboot. Terminating.
gmake: *** [erlang.mk:6450: run] Error 1
~/tunnel/
啊哈。我按照@lastcanal 的评论说明进行了操作,并且有效。谢谢。
我首先看到的是您没有 .app 文件
您可以在why-is-my-cowboy-server-not-running
中查看类似的问题
flag
在 tunnel_app.erl 模块中,您调用 cowboy:start_clear 的元数为 4,但此函数的元数为 3。这就是未定义错误的原因:
exited: {bad_return, {{tunnel_app,start,[normal,[]]}, {'EXIT', {undef, [{cowboy,start_clear, [my_http_listener,100, [{port,8080}],
...您应该删除参数“100”
这一定是 Cowboy 的早期版本,可能
我写了一个牛仔项目,我在 gmake run
的本地主机上启动。
当我 make run
进行全新安装时,出现此错误:
~/tunnel# make run
erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
make[1]: Entering directory `/root/tunnel/deps/cowboy'
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
make[2]: Entering directory `/root/tunnel/deps/cowlib'
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
make[2]: Leaving directory `/root/tunnel/deps/cowlib'
make[2]: Entering directory `/root/tunnel/deps/ranch'
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
make[2]: Leaving directory `/root/tunnel/deps/ranch'
../../erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
GEN rebar.config
make[1]: Leaving directory `/root/tunnel/deps/cowboy'
make[1]: Entering directory `/root/tunnel/deps/jiffy'
./rebar compile
==> jiffy (compile)
make[1]: Leaving directory `/root/tunnel/deps/jiffy'
DEPEND tunnel.d
erlang.mk:24: Please upgrade to GNU Make 4 or later: https://erlang.mk/guide/installation.html
ERLC tunnel_app.erl
APP tunnel
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/root/tunnel/ebin
/root/tunnel/deps
/usr/local/lib/erlang/lib
/root/tunnel/apps
/root/tunnel/_rel
===> Resolved tunnel_release-1
===> Including Erts from /usr/local/lib/erlang
===> release successfully created!
===> tarball /root/tunnel/_rel/tunnel_release/tunnel_release-1.tar.gz successfully created!
Exec: /root/tunnel/_rel/tunnel_release/erts-9.0/bin/erlexec -boot /root/tunnel/_rel/tunnel_release/releases/1/tunnel_release -mode embedded -boot_var ERTS_LIB_DIR /root/tunnel/_rel/tunnel_release/erts-9.0/../lib -config /root/tunnel/_rel/tunnel_release/releases/1/sys.config -args_file /root/tunnel/_rel/tunnel_release/releases/1/vm.args -- console
Root: /root/tunnel/_rel/tunnel_release
/root/tunnel/_rel/tunnel_release
heart_beat_kill_pid = 16083
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [kernel-poll:false]
=INFO REPORT==== 29-Sep-2017::11:46:35 ===
application: tunnel
exited: {bad_return,
{{tunnel_app,start,[normal,[]]},
{'EXIT',
{undef,
[{cowboy,start_clear,
[my_http_listener,100,
[{port,8080}],
#{env =>
#{dispatch =>
[{'_',[],
[{[<<"info">>],[],lobby_handler,[]},
{[<<"join">>,name],[],join_handler,[]},
{[<<"player">>,<<"status">>,name],
[],player_status_handler,[]},
{[<<"tables">>,<<"info">>,table_id],
[],table_info_handler,[]},
{[<<"tables">>,<<"play">>,table_id,name,auth,
action,x,y],
[],table_play_handler,[]},
{[<<"assets">>,'...'],
[],cowboy_static,
{dir,"/root/tunnel/static/assets/"}}]}]}}],
[]},
{tunnel_app,start,2,[{file,"src/tunnel_app.erl"},{line,17}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},{line,273}]}]}}}}
type: permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,tunnel,{bad_return,{{tunnel_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_clear,[my_http_listener,100,[{port,8080}],#{env => #{dispatch => [{'_',[],[{[<<\"info\">>],[],lobby_handler,[]},{[<<\"join\">>,name],[],join_handler,[]},{[<<\"player\">>,<<\"status\">>,name],[],player_status_handler,[]},{[<<\"tables\">>,<<\"info\">>,table_id],[],table_info_handler,[]},{[<<\"tables\">>,<<\"play\">>,table_id,name,auth,action,x,y],[],table_play_handler,[]},{[<<\"assets\">>,'...'],[],cowboy_static,{dir,\"/root/tunnel/static/assets/\"}}]}]}}],[]},{tunnel_app,start,2,[{file,\"src/tunnel_app.erl\"},{line,17}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,tunnel,{bad_return,{{tunnel_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_clear,[my_http_listener,100,[{port,8080}],#{
heart: Fri Sep 29 11:46:36 2017: Erlang is crashing .. (waiting for crash dump file)
heart: Fri Sep 29 11:46:36 2017: Would reboot. Terminating.
make: *** [run] Error 1
我认为 tunnel_app
不好 return这是我的tunnel_app.erl
-module(tunnel_app).
-behaviour(application).
-export([start/2]).
-export([stop/1]).
start(_Type, _Args) ->
Dispatch = cowboy_router:compile([
{'_', [
{"/info", lobby_handler, []},
{"/join/:name", join_handler, []},
{"/player/status/:name", player_status_handler, []},
{"/tables/info/:table_id", table_info_handler, []},
{"/tables/play/:table_id/:name/:auth/:action/:x/:y", table_play_handler, []},
{"/assets/[...]", cowboy_static, {dir, "/users/quantum/tunnel/static/assets/"}}
]}]),
{ok, _} = cowboy:start_clear(my_http_listener, 100,
[{port, 8080}],
#{env => #{dispatch => Dispatch}}),
{ok, MainDoor} = door:go(),
register(main_door, MainDoor),
{ok, MainRoom} = room:go(),
register(main_room, MainRoom),
tunnel_sup:start_link().
stop(_State) ->
ok.
和它用 start_link
调用的 tunnel_sup.erl
:
-module(tunnel_sup).
-behaviour(supervisor).
-export([start_link/0]).
-export([init/1]).
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
Procs = [],
{ok, {{one_for_one, 1, 5}, Procs}}.
我检查了我的 .gitignore
.erlang.mk/
*.beam
src/*.beam
_rel/
deps/
ebin/
完整的存储库在这里:https://github.com/quantumproductions/tunnel
我可以在我的机器上复制一个文件夹并且它可以工作。当我上传到 github 并下载它时,运行 失败。
~/tunnel3/ls
Makefile deps erlang.mk rel src tunnel.d
_rel ebin oldh relx.config static
~/tdep/ls
Makefile deps erlang.mk rel src tunnel.d
_rel ebin oldh relx.config static
第二个失败:
~/tdep/gmake run
Error: No Makefile to build dependency /Users/quantum/tdep/deps/cowboy.
gmake: *** [erlang.mk:4182: deps] Error 2
第一个文件夹工作正常
/tunnel3/gmake run
gmake[1]: Entering directory '/Users/quantum/tunnel3/deps/cowboy'
gmake[2]: Entering directory '/Users/quantum/tunnel3/deps/cowlib'
gmake[2]: Leaving directory '/Users/quantum/tunnel3/deps/cowlib'
gmake[2]: Entering directory '/Users/quantum/tunnel3/deps/ranch'
gmake[2]: Leaving directory '/Users/quantum/tunnel3/deps/ranch'
GEN rebar.config
gmake[1]: Leaving directory '/Users/quantum/tunnel3/deps/cowboy'
gmake[1]: Entering directory '/Users/quantum/tunnel3/deps/jiffy'
CC=gcc ./enc compile
gmake -f c_src/Makefile.erlang.mk
gmake[2]: Entering directory '/Users/quantum/tunnel3/deps/jiffy'
gmake[2]: Nothing to be done for 'all'.
gmake[2]: Leaving directory '/Users/quantum/tunnel3/deps/jiffy'
gmake[1]: Leaving directory '/Users/quantum/tunnel3/deps/jiffy'
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/Users/quantum/tunnel3/ebin
/Users/quantum/tunnel3/deps
/usr/local/Cellar/erlang/19.2/lib/erlang/lib
/Users/quantum/tunnel3/apps
/Users/quantum/tunnel3/_rel
什么配置可能导致此问题?
编辑:
Juanjo Martin 的回答有效,在我克隆的文件夹中。
在我的原始文件夹中,它没有,删除 100 参数得到以下结果。
为什么这在 1 个特定文件夹中不起作用?我必须 check/make 修复什么样的环境才能防止这种情况发生?好像 ~/tunnel
是 运行 不同版本的牛仔?
/tunnel/gmake run
gmake[1]: Entering directory '/Users/quantum/tunnel/deps/cowboy'
gmake[2]: Entering directory '/Users/quantum/tunnel/deps/cowlib'
gmake[2]: Leaving directory '/Users/quantum/tunnel/deps/cowlib'
gmake[2]: Entering directory '/Users/quantum/tunnel/deps/ranch'
gmake[2]: Leaving directory '/Users/quantum/tunnel/deps/ranch'
GEN rebar.config
gmake[1]: Leaving directory '/Users/quantum/tunnel/deps/cowboy'
gmake[1]: Entering directory '/Users/quantum/tunnel/deps/jiffy'
CC=gcc ./enc compile
gmake -f c_src/Makefile.erlang.mk
gmake[2]: Entering directory '/Users/quantum/tunnel/deps/jiffy'
gmake[2]: Nothing to be done for 'all'.
gmake[2]: Leaving directory '/Users/quantum/tunnel/deps/jiffy'
gmake[1]: Leaving directory '/Users/quantum/tunnel/deps/jiffy'
DEPEND tunnel.d
ERLC tunnel_app.erl
APP tunnel
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/Users/quantum/tunnel/ebin
/Users/quantum/tunnel/deps
/usr/local/Cellar/erlang/19.2/lib/erlang/lib
/Users/quantum/tunnel/apps
/Users/quantum/tunnel/_rel
===> Resolved tunnel_release-1
===> Including Erts from /usr/local/Cellar/erlang/19.2/lib/erlang
===> release successfully created!
===> tarball /Users/quantum/tunnel/_rel/tunnel_release/tunnel_release-1.tar.gz successfully created!
Exec: /Users/quantum/tunnel/_rel/tunnel_release/erts-8.2/bin/erlexec -boot /Users/quantum/tunnel/_rel/tunnel_release/releases/1/tunnel_release -mode embedded -boot_var ERTS_LIB_DIR /Users/quantum/tunnel/_rel/tunnel_release/erts-8.2/../lib -config /Users/quantum/tunnel/_rel/tunnel_release/releases/1/sys.config -args_file /Users/quantum/tunnel/_rel/tunnel_release/releases/1/vm.args -- console
Root: /Users/quantum/tunnel/_rel/tunnel_release
/Users/quantum/tunnel/_rel/tunnel_release
heart_beat_kill_pid = 3135
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
=INFO REPORT==== 5-Oct-2017::16:54:36 ===
application: tunnel
exited: {bad_return,
{{tunnel_app,start,[normal,[]]},
{'EXIT',
{undef,
[{cowboy,start_clear,
[my_http_listener,
[{port,8080}],
#{env => #{dispatch => [{'_',[],
[{[<<"info">>],[],lobby_handler,[]},
{[<<"join">>,name],
[],join_handler,[]},
{[<<"player">>,<<"status">>,name],
[],player_status_handler,[]},
{[<<"tables">>,<<"info">>,table_id],
[],table_info_handler,[]},
{[<<"tables">>,<<"play">>,table_id,
name,auth,action,x,y],
[],table_play_handler,[]},
{[<<"assets">>,'...'],
[],cowboy_static,
{dir,
"/users/quantum/tunnel/static/assets/"}}]}]}}],
[]},
{tunnel_app,start,2,
[{file,"src/tunnel_app.erl"},{line,17}]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,273}]}]}}}}
type: permanent
{"Kernel pid terminated",application_controller,"{application_start_failure,tunnel,{bad_return,{{tunnel_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_clear,[my_http_listener,[{port,8080}],#{env => #{dispatch => [{'_',[],[{[<<\"info\">>],[],lobby_handler,[]},{[<<\"join\">>,name],[],join_handler,[]},{[<<\"player\">>,<<\"status\">>,name],[],player_status_handler,[]},{[<<\"tables\">>,<<\"info\">>,table_id],[],table_info_handler,[]},{[<<\"tables\">>,<<\"play\">>,table_id,name,auth,action,x,y],[],table_play_handler,[]},{[<<\"assets\">>,'...'],[],cowboy_static,{dir,\"/users/quantum/tunnel/static/assets/\"}}]}]}}],[]},{tunnel_app,start,2,[{file,\"src/tunnel_app.erl\"},{line,17}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,tunnel,{bad_return,{{tunnel_app,start,[normal,[]]},{'EXIT',{undef,[{cowboy,start_clear,[my_http_listener,[{port,8080}],#{env
heart: Thu Oct 5 16:54:37 2017: Erlang is crashing .. (waiting for crash dump file)
heart: Thu Oct 5 16:54:37 2017: Would reboot. Terminating.
gmake: *** [erlang.mk:6450: run] Error 1
~/tunnel/
啊哈。我按照@lastcanal 的评论说明进行了操作,并且有效。谢谢。
我首先看到的是您没有 .app 文件
您可以在why-is-my-cowboy-server-not-running
中查看类似的问题flag
在 tunnel_app.erl 模块中,您调用 cowboy:start_clear 的元数为 4,但此函数的元数为 3。这就是未定义错误的原因:
exited: {bad_return, {{tunnel_app,start,[normal,[]]}, {'EXIT', {undef, [{cowboy,start_clear, [my_http_listener,100, [{port,8080}],
...您应该删除参数“100”
这一定是 Cowboy 的早期版本,可能