我正在尝试使用最新版本的phoenix / elixir / etc进行本教程:http://learnelixir.com/blog/2014/10/30/real-time-to-do-list-with-phoenix-channel/,但是我收到了phoenix_ecto的编译错误

版本如下:

[mariano:~/phoenix/realtime_todo]$ git remote -v
origin  https://github.com/phoenixframework/phoenix.git (fetch)
origin  https://github.com/phoenixframework/phoenix.git (push)

[mariano:~/phoenix/realtime_todo]$ git branch
* (detached from v0.10.0)
  master

[mariano:~/phoenix/realtime_todo]$ elixir -v
Elixir 1.0.5
[mariano:~/phoenix/realtime_todo]$ mix -v
Mix 1.0.5

[mariano:~/phoenix/realtime_todo]$ mix deps.compile phoenix_ecto
==> phoenix_ecto
Compiled lib/phoenix_ecto.ex
Compiled lib/phoenix_ecto/plug.ex
Compiled lib/phoenix_ecto/json.ex

== Compilation error on file lib/phoenix_ecto/html.ex ==
** (CompileError) lib/phoenix_ecto/html.ex:7: unknown key :impl for struct Phoenix.HTML.Form
    (elixir) src/elixir_map.erl:182: :elixir_map."-assert_struct_keys/5-lc$^0/1-0-"/5
    (elixir) src/elixir_map.erl:59: :elixir_map.translate_struct/4
    (elixir) src/elixir_clauses.erl:36: :elixir_clauses.clause/7
    (elixir) src/elixir_def.erl:178: :elixir_def.translate_clause/7
    (elixir) src/elixir_def.erl:167: :elixir_def.translate_definition/8

could not compile dependency phoenix_ecto, mix compile failed. You can recompile this dependency with `mix deps.compile phoenix_ecto` or update it with `mix deps.update phoenix_ecto`

最佳答案

看起来您要么缺少phoenix_html依赖项,要么正在使用它的不同版本。

将其添加到您的mix.exs文件:

defp deps do
  [{:phoenix, "~> 0.17.0"},
   {:ecto, "~> 0.16.0"},
   {:phoenix_ecto, "~> 1.1.0"},
   {:postgrex, ">= 0.0.0"},
   {:phoenix_html, "~> 2.1.0"},
   {:phoenix_live_reload, "~> 1.0", only: :dev}]
end


然后运行mix deps.get

关于elixir - 编译错误phoenix_ecto,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32121578/

10-11 03:01