【发布时间】:2016-12-09 06:42:39
【问题描述】:
我通过:iex -S mix phoenix.server 启动了一个 phoenix 应用程序服务器并得到以下错误:
[error] GenServer #PID<0.10289.0> terminating
** (UndefinedFunctionError) undefined function List.Chars.to_charlist/1
(elixir) List.Chars.to_charlist("localhost")
(postgrex) lib/postgrex/protocol.ex:46: Postgrex.Protocol.connect/1
(db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
我认为这可能是我的 config.exs 引起的:
config :bCareServer, BCareServer.Repo,
adapter: Ecto.Adapters.Postgres,
database: "bcareserver_dev",
hostname: "localhost",
pool_size: 10
数据库尚未设置。当我运行 `mix ecto.setup 时,它得到了同样的错误。
Postgresql 运行良好:
[root@Makercas001 bCareDev]#su - postgres
[postgres@Makercas001 ~]$psql
psql (9.5.3)
Type "help" for help.
postgres=#
它在我的 MacBook 上运行良好,只在 CentOS 上失败。 环境:CentOS6.5、Erlang/OTP 18、Elixir 1.2.6。
【问题讨论】:
-
您是否使用相同的凭据安装了
psql? -
是的,我愿意。我已经更新了这个问题。谢谢。
标签: postgresql elixir phoenix-framework