我试图在Phoenix项目上运行mix ecto.create并收到错误消息:
00:30:34.332 [error] GenServer #PID<0.328.0> terminating
(RuntimeError) Connect raised a CaseClauseError error. The exception details are hidden, as they may contain sensitive data such as database credentials.
(postgrex) lib/postgrex/utils.ex:40: Postgrex.Utils.parse_version/1
(postgrex) lib/postgrex/protocol.ex:497: Postgrex.Protocol.bootstrap_send/4
(postgrex) lib/postgrex/protocol.ex:353: Postgrex.Protocol.handshake/2
(db_connection) lib/db_connection/connection.ex:135: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
(Mix) The database for Discuss.Repo couldn't be created: an exception was raised:
(RuntimeError) Connect raised a CaseClauseError error. The exception details are hidden, as they may contain sensitive data such as database credentials.
(postgrex) lib/postgrex/utils.ex:40: Postgrex.Utils.parse_version/1
(postgrex) lib/postgrex/protocol.ex:497: Postgrex.Protocol.bootstrap_send/4
(postgrex) lib/postgrex/protocol.ex:353: Postgrex.Protocol.handshake/2
(db_connection) lib/db_connection/connection.ex:135: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
我的config / dev.exs
# Configure your database
config :discuss, Discuss.Repo,
adapter: Ecto.Adapters.Postgres,
username: "elixir",
password: "Ohtai3ai",
database: "discuss_dev",
hostname: "127.0.0.1",
pool_size: 10
我的Elixir版本是1.6.6(与OTP 19编译) Postgres 10
答案 0 :(得分:2)
postgrex
依赖性过时可能是原因,请尝试对其进行升级。
mix deps.update postgrex
解决方案来自postgrex issue #370,很容易找到googling the exact error message。
答案 1 :(得分:0)
已解决。只需更新以下版本 phoenix_ecto 3.3.0 邮编0.13.5 ecto 2.2.10