aaronrenner / phx_gen_auth

An authentication system generator for Phoenix 1.5 applications.
772 stars 55 forks source link

Error compiling the project #90

Closed joaothallis closed 4 years ago

joaothallis commented 4 years ago

There are some prerequirement to compile the code?

Steps to reproduce the problem:

➜  ~ git clone git@github.com:aaronrenner/phx_gen_auth.git
Cloning into 'phx_gen_auth'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 1688 (delta 3), reused 8 (delta 1), pack-reused 1670
Receiving objects: 100% (1688/1688), 456.34 KiB | 501.00 KiB/s, done.
Resolving deltas: 100% (712/712), done.
➜  ~ cd phx_gen_auth
➜  phx_gen_auth git:(master) mix deps.get
Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  earmark 1.4.4
  ex_doc 0.22.1
  makeup 1.0.1
  makeup_elixir 0.14.0
  mime 1.3.1
  nimble_parsec 0.5.3
  phoenix 1.5.3
  phoenix_pubsub 2.0.0
  phx_new 1.5.3
  plug 1.10.1
  plug_crypto 1.1.2
  telemetry 0.4.1
* Getting phoenix (Hex package)
* Getting phx_new (Hex package)
* Getting ex_doc (Hex package)
* Getting earmark (Hex package)
* Getting makeup_elixir (Hex package)
* Getting makeup (Hex package)
* Getting nimble_parsec (Hex package)
* Getting phoenix_pubsub (Hex package)
* Getting plug (Hex package)
* Getting plug_crypto (Hex package)
* Getting telemetry (Hex package)
* Getting mime (Hex package)
➜  phx_gen_auth git:(master) mix compile
===> Compiling telemetry
==> phoenix_pubsub
Compiling 11 files (.ex)
Generated phoenix_pubsub app
==> mime
Compiling 2 files (.ex)
Generated mime app
==> phx_new
Compiling 10 files (.ex)
warning: redefining module Mix.Tasks.Local.Phx (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Mix.Tasks.Local.Phx.beam)
  lib/mix/tasks/local.phx.ex:1

warning: redefining module Phx.New.Single (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Phx.New.Single.beam)
  lib/phx_new/single.ex:1

warning: redefining module Mix.Tasks.Phx.New.Web (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Mix.Tasks.Phx.New.Web.beam)
  lib/mix/tasks/phx.new.web.ex:1

warning: redefining module Phx.New.Ecto (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Phx.New.Ecto.beam)
  lib/phx_new/ecto.ex:1

warning: redefining module Phx.New.Generator (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Phx.New.Generator.beam)
  lib/phx_new/generator.ex:1

warning: redefining module Phx.New.Project (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Phx.New.Project.beam)
  lib/phx_new/project.ex:1

warning: redefining module Mix.Tasks.Phx.New (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Mix.Tasks.Phx.New.beam)
  lib/mix/tasks/phx.new.ex:1

warning: redefining module Mix.Tasks.Phx.New.Ecto (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Mix.Tasks.Phx.New.Ecto.beam)
  lib/mix/tasks/phx.new.ecto.ex:1

warning: redefining module Phx.New.Umbrella (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Phx.New.Umbrella.beam)
  lib/phx_new/umbrella.ex:1

warning: redefining module Phx.New.Web (current version loaded from /home/joao/.asdf/installs/elixir/1.11.1-otp-23/.mix/archives/phx_new-1.5.6/phx_new-1.5.6/ebin/Elixir.Phx.New.Web.beam)
  lib/phx_new/web.ex:1

== Compilation error in file lib/phx_new/ecto.ex ==
** (File.Error) could not read file "/tmp/mix-local-installer-fetcher-z7AszQ/deps/phx_new/templates/phx_umbrella/apps/app_name/config/config.exs": no such file or directory
    (elixir 1.11.1) lib/file.ex:354: File.read!/1
    lib/phx_new/generator.ex:31: anonymous fn/4 in Phx.New.Generator."MACRO-__before_compile__"/2
    (elixir 1.11.1) lib/enum.ex:2181: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/phx_new/generator.ex:27: anonymous fn/3 in Phx.New.Generator."MACRO-__before_compile__"/2
    (elixir 1.11.1) lib/enum.ex:2181: Enum."-reduce/3-lists^foldl/2-0-"/3
    expanding macro: Phx.New.Generator.__before_compile__/1
    lib/phx_new/ecto.ex:1: Phx.New.Ecto (module)
could not compile dependency :phx_new, "mix compile" failed. You can recompile this dependency with "mix deps.compile phx_new", update it with "mix deps.update phx_new" or clean it with "mix deps.clean phx_new"

I already tried with mix deps.compile phx_new", mix deps.update phx_new and mix deps.clean phx_new

➜  ~ elixir -v
Erlang/OTP 23 [erts-11.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Elixir 1.11.1 (compiled with Erlang/OTP 23)
➜  ~ erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell
23.0.2
josevalim commented 4 years ago

mix archive.uninstall phx_new and you should be good to go!

josevalim commented 4 years ago

Alternatively phx_gen_auth can add this to its mix.exs file:

for path <- :code.get_path,
    Regex.match?(~r/phx_new\-\d+\.\d+\.\d\/ebin$/, List.to_string(path)) do
  Code.delete_path(path)
end

But this problem will also be solved once we merge it into Phoenix. :)

joaothallis commented 4 years ago

Another option is to use MIX_ENV=prod mix compile