AgilionApps / remix

Automatic recompilation of mix code on file change.
Other
149 stars 26 forks source link

Mix.Tasks.Compile.Elixir is not available #4

Open AntonFagerberg opened 8 years ago

AntonFagerberg commented 8 years ago

I've defined a mix server task (link) in my project which can be used to launch the app, but when I do so in dev mode I get the following error message:

21:57:37.238 [error] GenServer Remix.Worker terminating
** (UndefinedFunctionError) undefined function: Mix.Tasks.Compile.Elixir.run/1 (module Mix.Tasks.Compile.Elixir is not available)
    Mix.Tasks.Compile.Elixir.run(["--ignore-module-conflict"])
    (remix) lib/remix.ex:35: Remix.Worker.handle_info/2
    (stdlib) gen_server.erl:615: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:681: :gen_server.handle_msg/5
    (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: :poll_and_reload
State: %Remix.Worker.State{last_mtime: nil}

Can this be fixed in any way or does the recompilation only work when launched with iex -S mix?

The same thing goes when launching from an escript. I understand though that in this case the project can't be recompiled but perhaps the error message can be suppressed (not sure it's a good idea).

Thanks for a great project!

alanpeabody commented 8 years ago

Hi @AntonFagerberg, I haven't actually tried using this outside of iex -S mix (and of course it should only be used in dev).

Can you share an example mix server task definition that I can troubleshoot with?

AntonFagerberg commented 8 years ago

I did link it in my previous post but here it is again :) https://github.com/AntonFagerberg/rackla/blob/master/lib/mix/server.ex

alanpeabody commented 8 years ago

Oh jeeze, reading comprehension fail. I will pull down rackla and take a look this weekend. Thanks.

alanpeabody commented 8 years ago

Hi @AntonFagerberg, I just didn't get to this over the weekend and frankly I am not sure when I will have time to really dedicate to it.

This code is based off of some of the early reload code in Phoenix, it might be worth taking a look at that to check how they are doing it. I also think a new or upcoming version of Elixir may have something built in to recompile all known files?

AntonFagerberg commented 8 years ago

No problem, I don't think this is a big issue since iex -S mix is commonly used when developing anyway. It might even be that how it works right now is the correct behavior - mix server should generally be used in production mode anyway.

This was more of a FYI and something that would be nice to fix if possible but I can live with it as it is now so no worries! I'm also short on spare time ATM so I won't be looking in to this myself in the near future.

I also remember reading a while back that Elixir may have something like that. Let's hope it becomes a reality. In the mean time, I think remix works fine as it is! :)

I'll leave the issue open here for future reference.

holyxiaoxin commented 8 years ago

I am having this problem as well. any updates?

alanpeabody commented 8 years ago

@holyxiaoxin Sorry, I have not had an opportunity to look into it. PRs and suggestions super welcome!