Phoenix cannot start - AppName.Endpoint.start_link is missing

Pheonix changes so often that I'm not sure what I'm doing is right.

I try to follow some tutorials, and they all have the “mix phoenix.start” command right after the compilation is complete and start the server. (There is some talk on the Github problems page that they are going to replace this with the mix phoenix.server command, and you should do something manually and not follow it. In any case, this is development version v0.8.0- dev I am using the latest stable version 0.7.2)

I get an error trying to issue the "mix phoenix.start" command trying to start the server

(AppName: PhoenixCrud):

> mix phoenix.start =INFO REPORT==== 13-Dec-2014::15:23:08 === application: logger exited: stopped type: temporary =INFO REPORT==== 13-Dec-2014::15:23:08 === application: cowboy exited: stopped type: temporary =INFO REPORT==== 13-Dec-2014::15:23:08 === application: cowlib exited: stopped type: temporary =INFO REPORT==== 13-Dec-2014::15:23:08 === application: ranch exited: stopped type: temporary ** (Mix) Could not start application phoenix_crud: PhoenixCrud.start(:normal, []) returned an error: shutdown: failed to start child: PhoenixCrud.Endpoint ** (EXIT) an exception was raised: ** (UndefinedFunctionError) undefined function: PhoenixCrud.Endpoint.start_link/0 (phoenix_crud) PhoenixCrud.Endpoint.start_link() (stdlib) supervisor.erl:314: :supervisor.do_start_child/2 (stdlib) supervisor.erl:297: :supervisor.start_children/3 (stdlib) supervisor.erl:263: :supervisor.init_children/2 (stdlib) gen_server.erl:306: :gen_server.init_it/6 (stdlib) proc_lib.erl:237: :proc_lib.init_p_do_apply/3 

The documents have an updated phoenix.server command, but I tried it too, and this mix says that the task cannot be found.

In any case, it looks like the start_link function is missing in app_name / lib / app_name / endpoint.ex. Should I provide this? I have no idea what to put now, because I'm just trying to create a Phoenix web framework and know nothing about it (hence the lessons.)

So, I have to provide the start_link function, if so, can someone give me a little to go into it, to try to follow some tutorials. Otherwise, is this a mistake?

+6
source share
4 answers

The knowledge of git is not so great, but here goes:

To use the 0.7.2 branch, you need to specifically check the v0.7.2 tag. So here is how I did it:

 git clone https://github.com/phoenixframework/phoenix.git cd phoenix git checkout tags/v0.7.2 mix do deps.get, compile mix phoenix.new app_name ../app_name cd ../app_name #change the mix deps to: (I think you can just use default hex deps as well) {:phoenix, github: "phoenixframework/phoenix", tag: "v0.7.2"} mix do deps.get, compile mix phoenix.start 

Otherwise, the Phoenix code to which you usually clone git is on the main branch, at 0.8.0-dev, that you will need to set the depilation to the github master server branch (as indicated by @JoseValim)

 {:phoenix, github: "phoenixframework/phoenix"} 

This means that now you need to use the mix phoenix.server command.

Hope this helps others.

+2
source

This is a version of the Phoenix. The endpoint is only available in master, but it seems that you are not using master. You must either add {:phoenix, github: "phoenixframework/phoenix"} to your mix.exs , or create a Phoenix project from branch 0.7.2.

+5
source

It seems your server is already running. You just need to kill it and restart using the killall beam.smp command

0
source

I tried adding the specified string to mix.exs, but getting the same error. I don’t know how to fix “without using a wizard”, since most of this was created for me. I am also starting to use this tool. I follow the instructions in the help file of the phoenix frame and am a little discouraged.

jeff @Kudu: ~ / Test.Elixir / my_app $ mix phoenix.server ** (UndefinedFunctionError) undefined function: MyApp.Endpoint.serve / 0 (module MyApp.Endpoint not available) MyApp.Endpoint.serve () (elixir) lib / enum.ex: 537: Enum. "- each / 2-list ^ foreach / 1-0 -" / 2 (elixir) lib / enum.ex: 537: Enum.each / 2 (phoenix) lib / mix / tasks / phoenix.server.ex: 44: Mix.Tasks.Phoenix.Server.run/1 (mix) lib / mix / cli.ex: 55: Mix.CLI.run_task / 2

-2
source

Source: https://habr.com/ru/post/979560/


All Articles