2017-02-16 59 views
0

我安裝rebar3並且創造Rebar3 +牛仔內核PID終止

cd ~/apps rebar3 new release tunnel

然後

我複製我的src文件從~/tunnel/src/*~/apps/tunnel/src/

一個新的版本我遇到了一個編譯與rebar3 run錯誤,並找到Erlang "Kernel pid terminated" error作爲一種可能的解決方案。我將關於tunnel_app的所有內容重命名爲tunnel。所以我的src包含tunnel.erl,tunnel.app.srctunnel_sup.erl。我根據需要重新命名了模塊定義。

這裏的rebar3 run錯誤:

~/apps/tunnel:.rebar3 run 
===> Verifying dependencies... 
===> Compiling tunnel 
===> Starting relx build process ... 
===> Resolving OTP Applications from directories: 
      /Users/quantum/apps/tunnel/_build/default/lib 
      /Users/quantum/apps/tunnel/apps 
      /usr/local/Cellar/erlang/19.2/lib/erlang/lib 
      /Users/quantum/apps/tunnel/_build/default/rel 
===> Resolved tunnel-0.1.0 
===> Dev mode enabled, release will be symlinked 
===> release successfully created! 
readlink: illegal option -- f 
usage: readlink [-n] [file ...] 
Exec: /usr/local/Cellar/erlang/19.2/lib/erlang/erts-8.2/bin/erlexec -boot /Users/quantum/apps/tunnel/_build/default/rel/tunnel/releases/0.1.0/tunnel -mode embedded -boot_var ERTS_LIB_DIR /usr/local/Cellar/erlang/19.2/lib/erlang/lib -config /Users/quantum/apps/tunnel/_build/default/rel/tunnel/releases/0.1.0/sys.config -args_file /Users/quantum/apps/tunnel/_build/default/rel/tunnel/releases/0.1.0/vm.args -pa -- console 
Root: /Users/quantum/apps/tunnel/_build/default/rel/tunnel 
/Users/quantum/apps/tunnel/_build/default/rel/tunnel 
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:30] [hipe] [kernel-poll:true] [dtrace] 


=INFO REPORT==== 16-Feb-2017::15:02:21 === 
    application: tunnel 
    exited: {bad_return, 
       {{tunnel,start,[normal,[]]}, 
       {'EXIT', 
        {undef, 
         [{cowboy_router,compile, 
           [[{'_', 
            [{"/info",lobby_handler,[]}, 
            {"/join/:name",join_handler,[]}, 
            {"/play/:table_pid/:name/:auth/:team/:action/:x/:y", 
             play_handler,[]}]}]], 
           []}, 
          {tunnel,start,2, 
           [{file, 
            "/Users/quantum/apps/tunnel/_build/default/lib/tunnel/src/tunnel.erl"}, 
           {line,8}]}, 
          {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,start,[normal,[]]},{'EXIT',{undef,[{cowboy_router,compile,[[{'_',[{\"/info\",lobby_handler,[]},{\"/join/:name\",join_handler,[]},{\"/play/:table_pid/:name/:auth/:team/:action/:x/:y\",play_handler,[]}]}]],[]},{tunnel,start,2,[{file,\"/Users/quantum/apps/tunnel/_build/default/lib/tunnel/src/tunnel.erl\"},{line,8}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"} 
Kernel pid terminated (application_controller) ({application_start_failure,tunnel,{bad_return,{{tunnel,start,[normal,[]]},{'EXIT',{undef,[{cowboy_router,compile,[[{'_',[{"/info",lobby_handler,[]},{"/j 

Crash dump is being written 

這是爲什麼崩潰?

+0

你爲什麼要SRC文件複製從〜/隧道/ src目錄/ *到〜/應用/隧道/ src目錄/? – byaruhaf

+0

@byaruhaf我在〜/ tunnel/src中已經有了我的項目src文件。 – quantumpotato

回答

1

如果這是你與rebar3第一次的經驗,我建議從一個OTP應用程序,而不是一個OTP版本:

rebar3 new app tunnel 

,然後不要盲目在源文件,因爲你可能在覆蓋這些文件複製已在src以下爲您創建。事先查看該目錄的內容。

我也建議花時間閱讀rebar3 https://www.rebar3.org/docs/basic-usage頁面。

您還必須閱讀有關OTP應用程序的內容。我知道,相當多的理解,有時令人困惑。免費來源是http://learnyousomeerlang.com/building-applications-with-otp。購買關於Erlang的書也是值得的。有幾個,我建議https://www.manning.com/books/erlang-and-otp-in-action

還有一個在線課程,免費,啓動幾天(2017年2月20日)https://www.mooc-list.com/course/functional-programming-erlang-futurelearn

+0

謝謝!我在https://gist.github.com/flbuddymooreiv/ce1d7a47b12c27bf1616。在LearnYouSomeErlang中,我是其中的幾個章節,感謝您指出了這一點。我會看看課程和RTFM =) – quantumpotato

+0

啊我看到'rebar3 release'使多個應用程序可用與應用程序只是一個src目錄 – quantumpotato