rebar3



Build better Erlang.

Ask A Question

Questions

2

rebar3 run crashes, why is that?

### ./src/helloerlang_app.erl ``` %%%------------------------------------------------------------------- %% @doc helloerlang public API %% @end %%%------------------------------------------------------------------- -module(helloerlang_app). -behaviour(application). %% Application callbacks -export([start/2, stop/1, routes/0]). %%==================================================================== %% API %%==================================================================== start(_StartType, _StartArgs) -> Dispatch = cowboy_router:compile([&#123;'_', routes() &#125;]), ok = case cowboy:start_http( helloerlang_http_listener, 100, [&#123;port, 4000&#125;], [&#123;env, [&#123;dispatch, Dispatch&#125;]&#125;]) of &#123;ok, _&#125; -> ok; &#123;error, &#123;already_started, _&#125;&#125; -> ok; &#123;error, _&#125; = Error -> Error end, helloerlang_sup:start_link(). %% helloerlang_sup:start_link(). %%-------------------------------------------------------------------- stop(_State) -> ok. %%==================================================================== %% Internal functions %%==================================================================== routes() -> [ &#123;"/", cowboy_static, &#123;priv_file, helloerlang, "index.html"&#125;&#125; ]. ``` ### ./rebar.config: ``` &#123;erl_opts, [debug_info]&#125;. &#123;deps, [ cowboy ]&#125;. &#123;shell, [ % &#123;config, "config/sys.config"&#125; &#123;apps, [helloerlang]&#125; ]&#125;. &#123;relx, [&#123;release, &#123; local, "0.1.0" &#125;, [helloerlang]&#125;, &#123;dev_mode, true&#125;, &#123;extended_start_script, true&#125;] &#125;. &#123;plugins, [ rebar3_run ]&#125;. ``` ### ./priv_file/index.html ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <p>Test rebar page </p> </body> </html> ``` $ rebar3 compile ===> Verifying dependencies... ===> Compiling helloerlang then $ rebar3 run ===> Verifying dependencies... ===> Compiling helloerlang ===> Starting relx build process ... ===> Resolving OTP Applications from directories: /Users/mincheung/idea_projects/helloerlang/_build/default/lib /usr/local/Cellar/erlang/21.2.2/lib/erlang/lib /Users/mincheung/idea_projects/helloerlang/_build/default/rel ===> Resolved local-0.1.0 ===> Dev mode enabled, release will be symlinked ===> Including Erts from /usr/local/Cellar/erlang/21.2.2/lib/erlang ===> release successfully created! Exec: /Users/mincheung/idea_projects/helloerlang/_build/default/rel/local/erts-10.2.1/bin/erlexec -boot /Users/mincheung/idea_projects/helloerlang/_build/default/rel/local/releases/0.1.0/local -mode embedded -boot_var ERTS_LIB_DIR /Users/mincheung/idea_projects/helloerlang/_build/default/rel/local/lib -config /Users/mincheung/idea_projects/helloerlang/_build/default/rel/local/releases/0.1.0/sys.config -args_file /Users/mincheung/idea_projects/helloerlang/_build/default/rel/local/releases/0.1.0/vm.args -pa -- console Root: /Users/mincheung/idea_projects/helloerlang/_build/default/rel/local /Users/mincheung/idea_projects/helloerlang/_build/default/rel/local Erlang/OTP 21 [erts-10.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace] =CRASH REPORT==== 12-Jan-2019::05:42:21.587864 === crasher: initial call: application_master:init/4 pid: <0.229.0> registered_name: [] exception exit: &#123;bad_return, &#123;&#123;helloerlang_app,start,[normal,[]]&#125;, &#123;'EXIT', &#123;undef, [&#123;cowboy_router,compile, [[&#123;'_', [&#123;"/",cowboy_static, &#123;priv_file,helloerlang,"index.html"&#125;&#125;]&#125;]], []&#125;, &#123;helloerlang_app,start,2, [&#123;file, "/Users/mincheung/idea_projects/helloerlang/src/helloerlang_app.erl"&#125;, &#123;line,18&#125;]&#125;, &#123;application_master,start_it_old,4, [&#123;file,"application_master.erl"&#125;,&#123;line,277&#125;]&#125;]&#125;&#125;&#125;&#125; in function application_master:init/4 (application_master.erl, line 138) ancestors: [<0.228.0>] message_queue_len: 1 messages: [&#123;'EXIT',<0.230.0>,normal&#125;] links: [<0.228.0>,<0.190.0>] dictionary: [] trap_exit: true status: running heap_size: 610 stack_size: 27 reductions: 234 neighbours: =INFO REPORT==== 12-Jan-2019::05:42:21.590625 === application: helloerlang exited: &#123;bad_return, &#123;&#123;helloerlang_app,start,[normal,[]]&#125;, &#123;'EXIT', &#123;undef, [&#123;cowboy_router,compile, [[&#123;'_', [&#123;"/",cowboy_static, &#123;priv_file,helloerlang,"index.html"&#125;&#125;]&#125;]], []&#125;, &#123;helloerlang_app,start,2, [&#123;file, "/Users/mincheung/idea_projects/helloerlang/src/helloerlang_app.erl"&#125;, &#123;line,18&#125;]&#125;, &#123;application_master,start_it_old,4, [&#123;file,"application_master.erl"&#125;,&#123;line,277&#125;]&#125;]&#125;&#125;&#125;&#125; type: permanent Eshell V10.2.1 (abort with ^G) (local@Mins-MBP)1> &#123;"Kernel pid terminated",application_controller,"&#123;application_start_failure,helloerlang,&#123;bad_return,&#123;&#123;helloerlang_app,start,[normal,[]]&#125;,&#123;'EXIT',&#123;undef,[&#123;cowboy_router,compile,[[&#123;'_',[&#123;\"/\",cowboy_static,&#123;priv_file,helloerlang,\"index.html\"&#125;&#125;]&#125;]],[]&#125;,&#123;helloerlang_app,start,2,[&#123;file,\"/Users/mincheung/idea_projects/helloerlang/src/helloerlang_app.erl\"&#125;,&#123;line,18&#125;]&#125;,&#123;application_master,start_it_old,4,[&#123;file,\"application_master.erl\"&#125;,&#123;line,277&#125;]&#125;]&#125;&#125;&#125;&#125;&#125;"&#125; Kernel pid terminated (application_controller) (&#123;application_start_failure,helloerlang,&#123;bad_return,&#123;&#123;helloerlang_app,start,[normal,[]]&#125;,&#123;'EXIT',&#123;undef,[&#123;cowboy_router,compile,[[&#123;'_',[&#123;"/",cowboy_stati Crash dump is being written to: erl_crash.dump...done

Posted by Sebastian Cheung about a month ago

2

rebar3_erlydtl_plugin windows fails

After reviewing alot comments regarding usage of the rebar3_erlydtl_plugin, I am having trouble compiling the template files to the destination ebin directory. I added the DEBUG=1 setting to see the details of rebar3 build and additional tags to try to extract what erlydtl library is complaining about. Below is the setting in the local rebar.config file for subfolder that contains the "priv folder with the web content. {erlydtl_opts, [ {doc_root, "priv/templates"}, {out_dir, "ebin"}, {compiler_options, [report_errors, return, verbose, debug_info]}, {source_ext, ".dtl"}, {module_ext, "_view"}, {return, true}, {report, true} ]}. {plugins, [ {rebar3_erlydtl_plugin, ".*", {git, "https://github.com/tsloughter/rebar3_erlydtl_plugin.git", {branch, "master"}}} ]}. {provider_hooks, [ {pre, [{compile, {erlydtl, compile}}]} ]}. Below is the partial output of the rebar3 showing that it doesn't recognize the out_dir folder; however, the path is correct and I suspect that the symlinks may be the issue, since windows seem to behave as it should with them. ===> run_hooks("c:/SPRTVL/source/dashboard", pre_hooks, compile) -> no hooks defined ===> sh info: cwd: "c:/SPRTVL/source/dashboard" cmd: cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\priv" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\priv" ===> opts: [{use_stdout,false},return_on_error] ===> Port Cmd: cmd /q /c cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\priv" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\priv" Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> sh info: cwd: "c:/SPRTVL/source/dashboard" cmd: cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\include" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\include" ===> opts: [{use_stdout,false},return_on_error] ===> Port Cmd: cmd /q /c cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\include" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\include" Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> sh info: cwd: "c:/SPRTVL/source/dashboard" cmd: cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\src" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\src" ===> opts: [{use_stdout,false},return_on_error] ===> Port Cmd: cmd /q /c cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\src" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\src" Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> Compiling web ===> Running erlydtl... ===> Compiling "c:/SPRTVL/source/dashboard/apps/web/priv/templates/tl.dtl" -> "c:/SPRTVL/source/dashboard/_build/default/lib/web/ebin/tl_view.beam" with options: [{compiler_options,[report_errors,return,verbose,debug_info]}, {custom_tags_dir,"c:/SPRTVL/source/dashboard/apps/web"}, {doc_root,"c:/SPRTVL/source/dashboard/apps/web/priv/templates"}, {out_dir,"ebin"}, {compiler_options,[report_errors,return,verbose,debug_info]}, {out_dir,"c:/SPRTVL/source/dashboard/_build/default/lib/web/ebin"}, {source_ext,".dtl"}, {module_ext,"_view"}, {return,true}, {report,true}] c:/SPRTVL/source/dashboard/apps/web/priv/templates/tl.dtl: Failed to write file: no such file or directory ===> Compiling apps/web/priv/templates/tl.dtl failed c:/SPRTVL/source/dashboard/apps/web/priv/templates/tl.dtl:none: Failed to write file: no such file or directory ===> Compilation failed: {error, [["c:/SPRTVL/source/dashboard/apps/web/priv/templates/tl.dtl:none: Failed to write file: no such file or directory\n"]], []}

Posted by Jeff Starnes about a year ago