【问题标题】:(UndefinedFunctionError) undefined function List.Chars.to_charlist/1(UndefinedFunctionError) 未定义函数 List.Chars.to_charlist/1
【发布时间】: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


【解决方案1】:

哦,我用的是高版本的elixir,重装elixir 1.2的时候,又忘了跑mix do deps.get, compile,见谅...

【讨论】:

    【解决方案2】:

    List.Chars.to_charlist 是 1.3 中的新功能。 Changelog.

    以前是List.Chars.to_char_list

    【讨论】:

    • 我的灵药版本是1.2.6
    猜你喜欢
    • 2019-04-12
    • 2021-08-28
    • 1970-01-01
    • 2021-11-18
    • 2012-01-07
    • 1970-01-01
    • 2017-12-09
    • 2015-03-04
    • 2014-10-31
    相关资源
    最近更新 更多