-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
I had problems getting my phoenix app up and running after installing erlang 19. I had switched to elixir 1.3 to see if that solves the problem. Many dependencies failed and there was a warning to update a piece of my code in mix.exs file from this
def application do
apps = [:phoenix, :phoenix_html, :cowboy, :logger, :gettext, :comeonin, :plugsnag, :phoenix_ecto, :mariaex, :cqerl, :cqex, :tzdata, :logger_file_backend, :timex, :gcm, :httpoison, :remodel, :tirexs]
if Mix.env != :dev do
List.insert_at apps, length(apps), :apns
end
[mod: {Server, []},
applications: apps]
end
to
def application do
apps = [:phoenix, :phoenix_html, :cowboy, :logger, :gettext, :comeonin, :plugsnag, :phoenix_ecto, :mariaex, :cqerl, :cqex, :tzdata, :logger_file_backend, :timex, :gcm, :httpoison, :remodel, :tirexs]
**apps = ** if Mix.env != :dev do
List.insert_at apps, length(apps), :apns
end
[mod: {Server, []},
applications: apps]
end
I know there is problem with the change but ignored it in the beginning. I had reverted back to erlang 18 and elixir 1.2.3 to get the app working because of the dependency issue. Unfortunately I din't revert the above piece of code to its old state. I did deps fetch and compile and I got a weird error which has no clue of what was wrong.
** (FunctionClauseError) no function clause matching in Enum.do_all?/2
(elixir) lib/enum.ex:2399: Enum.do_all?(nil, &:erlang.is_atom/1)
(mix) lib/mix/tasks/compile.app.ex:172: anonymous fn/1 in Mix.Tasks.Compile.App.validate_properties/1
(elixir) lib/enum.ex:604: Enum."-each/2-lists^foreach/1-0-"/2
(elixir) lib/enum.ex:604: Enum.each/2
(mix) lib/mix/tasks/compile.app.ex:149: Mix.Tasks.Compile.App.validate_properties/1
(mix) lib/mix/tasks/compile.app.ex:99: Mix.Tasks.Compile.App.run/1
(elixir) lib/enum.ex:1088: Enum."-map/2-lists^map/1-0-"/2
(elixir) lib/enum.ex:1088: Enum."-map/2-lists^map/1-0-"/2
(mix) lib/mix/tasks/compile.all.ex:19: anonymous fn/1 in Mix.Tasks.Compile.All.run/1
(mix) lib/mix/tasks/compile.all.ex:37: Mix.Tasks.Compile.All.with_logger_app/1
(mix) lib/mix/tasks/compile.ex:87: Mix.Tasks.Compile.run/1
(mix) lib/mix/tasks/app.start.ex:38: Mix.Tasks.App.Start.run/1
(mix) lib/mix/tasks/run.ex:63: Mix.Tasks.Run.run/1
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
(elixir) lib/code.ex:363: Code.require_file/2
I had spent long time and finally went to the compile mix tasks file(lib/mix/tasks/compile.app.ex:172) in elixir repo here which gave an idea that :applications is set to nil.
I am not sure if it is intended to print this kind of error, but if the error had explicitly said, applications atom cannot have nil in mix.exs file, I would have figured out the issue way earlier. Is there a chance we can improve this error handling??
Registering it, just in case if any one face this issue, they can get clue where to look for.
I leave this to you guys. If it can be improved, please do it. You guys know what is best.