Phoenix@Ubuntu

ベースは以下の記事を元にElixir + Phoenix インストールしてみた際の色々とトラブったので備忘録

qiita.com

PostgreSQLのインストール、起動で以下のエラーとなる。
解決方法は以下のページではうまく行かない。

stackoverflow.com


環境は


PostgreSQLのインストール時にデータベース起動には以下を実行と書かれてるので実行しても起動せず

/usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start

logfileを確認

postgres: could not access the server configuration file /var/lib/postgresql/10/main/postgresql.conf: No such file or directory

  • D のデータベース先にconfigファイルも必要なようなので

ln -s /etc/postgresql/10/main/postgresql.conf /var/lib/postgresql/10/main/
ln -s /etc/postgresql/10/main/conf.d /var/lib/postgresql/10/main/

と、シンボリックリンクを作成

再度、

/usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start
waiting for server to start.... done
server started

起動成功

mydbデータベースの作成もうまくいく


mix phx.new hello OK

mix ecto.create 失敗

phx.new hello中の出力に

We are almost there! The following steps are missing:

$ cd hello
$ cd assets && npm install && node node_modules/brunch/bin/brunch build

と出るので、これを実行

mix locale.hex 成功
mix ecto.create 失敗
mix deps.get
mix ecto.create 成功

mix.phx.server 失敗
エラー出通りに
mix.exsを編集

  • {:plug_cowboy, "~> 1.0"} の追記
  • "test" --> test

再度、mix deps.get 成功
mix phx.server サーバー起動成功