Steps to reproduce:
$ mix local.hex
$ mix archive.uninstall phx_new
$ mix archive.install hex phx_new 1.4.6
$ mix new --umbrella demo
$ cd demo/apps
$ mix phx.new.web demo_web --no-ecto
At this stage, edit config/config.exs and add, at the end the following line: config :phoenix, :json_library, Jason
$ cd demo_web
$ mix phx.server
At this point I expect the server to be running
The server did not start: Tried the same on differents PCs, even with one from Brazil :)
Result:
➜ demo_web $ mix phx.server
17:08:46.922 [info] Access DemoWeb.Endpoint at http://localhost
Nothing more...
Successfully reproduced it following the same steps. Interesting that the [info] Running SeatScoutsWeb.Endpoint with cowboy 2.6.3 at 0.0.0.0:4000 (http) line doesn't appear in stdout.
Hey, @psantos10. Have you tried adding import_config "#{Mix.env()}.exs" after the config :phoenix, :json_library, Jason line?
adding import_config "#{Mix.env()}.exs" solved the issue. Thank you!
But how should I know about this?
if I try to run without this: config :phoenix, :json_library, Jason I will receive an error like this:
warning: failed to load Jason for Phoenix JSON encoding
(module Jason is not available).Ensure Jason exists in your deps in mix.exs,
and you have configured Phoenix to use it for JSON encoding by
verifying the following exists in your config/config.exs:config :phoenix, :json_library, Jason
Maybe the same should happen for this case.
Indeed, this is something that might be worth adding to the config template for the phx.new.web generator.
I can also confirm that works. I have also checked the behavior of previous versions and it seems this behavior started with 1.4.4 -- probably related to the change to generators not including config files for children apps.
@britto Sounds like a good first PR for me to work on!
Most helpful comment
Hey, @psantos10. Have you tried adding
import_config "#{Mix.env()}.exs"after theconfig :phoenix, :json_library, Jasonline?