adapter Ecto.Adapters.Postgres was not compiled

  • A+
Category:Languages

I am not able to create my Phoenix project. Would love some advice on how to fix it.

Setup details:

  • Ubuntu 16.04.4 LTS
  • Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]
  • Elixir 1.7.3 (compiled with Erlang/OTP 20)
  • Mix 1.7.3 (compiled with Erlang/OTP 20)
  • Ecto v3.0.0

I am following the Phoenix Up and Running to make an app.

mix phx.new hello cd hello mix ecto.create 

last command gives me:

 == Compilation error in file lib/hello/repo.ex ==  ** (ArgumentError) adapter Ecto.Adapters.Postgres was not compiled, ensure it is correct and it is included as a project dependency      lib/ecto/repo/supervisor.ex:71: Ecto.Repo.Supervisor.compile_config/2      lib/hello/repo.ex:2: (module)      (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6      (elixir) lib/kernel/parallel_compiler.ex:206: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6 

I have postgres installed. I have postgres super user.

 


Do you have phoenix_ecto 3.5.0 in your dependencies? Downgrading to 3.4.0 worked for me as a temporary fix until I figure out the underlying issue.

To force a downgrade:

  1. Run mix deps.clean --all
  2. Delete your mix.lock file
  3. Update your mix.exs file limiting the phoenix_ecto version. Find the appropriate line and replace with: {:phoenix_ecto, ">= 3.2.0 and < 3.5.0"},
  4. Run mix deps.get

Alternatively, if you are just starting with Phoenix, you could use version 1.4 to learn, which will be released soon and does not have this issue.

First remove your current local Phoenix archive:

mix archive.uninstall phx_new

Then, to install the latest development version, follow the instructions in https://github.com/phoenixframework/phoenix/blob/master/installer/README.md

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: