3

我正在尝试使用当前版本的 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`
4

1 回答 1

2

看起来您要么缺少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

于 2015-08-20T15:00:34.117 回答