Pheonix changes so frequently that I'm not sure that what I'm doing is right.
I'm trying to follow some tutorials, and all of them have the 'mix phoenix.start' command right after you finish compiling and that should start the server. (There is some talk on the issues page of Github that they are going to replace that with the mix phoenix.server command and you have to do something manually, not really following it. Anyways, that is in the development version v0.8.0-dev. I'm using the latest stable version 0.7.2)
I'm getting 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 docs have the updated phoenix.server command, but I tried that also, and that mix says that the task could not be found.
Anyways, it looks as if the app_name/lib/app_name/endpoint.ex is missing a start_link function. Am I supposed to provide that? I have no idea right now what to put in because I'm just trying out the Phoenix web framework and don't know anything about it (hence the tutorials.)
So, am I supposed to provide the start_link function, if so, can some give me some to stub in for now to try to follow some tutorials. Otherwise is it a bug?
It is a Phoenix version thing. The endpoint is only available in master, but it seems you are not using master. You should either add {:phoenix, github: "phoenixframework/phoenix"}
to your mix.exs
or generate a Phoenix project from the 0.7.2 branch.
My git knowledge is not that great, but here goes:
To use 0.7.2 branch, you need to specifically checkout v0.7.2 tag. So this 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 that you normally git clone is on the master branch is on 0.8.0-dev, which you will need to set the deps to the github master branch (as stated by @JoseValim)
{:phoenix, github: "phoenixframework/phoenix"}
Which means, you now need to use the mix phoenix.server command.
Hope that helps others.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With