3
votes

I start a phoenix application server by: iex -S mix phoenix.server and get the following error:

[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

I think it may caused by my config.exs:

config :bCareServer, BCareServer.Repo,
  adapter: Ecto.Adapters.Postgres,
  database: "bcareserver_dev",
  hostname: "localhost",
  pool_size: 10

The database has not been setup. When I run `mix ecto.setup, it gets the same error.

Postgresql works well:

[root@Makercas001 bCareDev]#su - postgres
[postgres@Makercas001 ~]$psql
psql (9.5.3)
Type "help" for help.

postgres=# 

And it works fine on my MacBook, and only fails on CentOS. Environment: CentOS6.5, Erlang/OTP 18, Elixir 1.2.6.

2
Do you have there psql installed with the same credentials? - PatNowak
Yes, I do. I have updated the question. Thanks. - Veetase

2 Answers

1
votes

List.Chars.to_charlist was new in 1.3. Changelog.

Before, it was List.Chars.to_char_list

0
votes

OH, I used a higher version of elixir and when reinstall elixir 1.2, I forgot to run mix do deps.get, compile again, forgive me ...