Ich bin nach diesem Tutorial Elixir blog in 15 minutes using Phoenix framework - Step by StepPostgres - Phoenix/Elixir Fehler installieren
Aber ich ein Problem habe, das ich keine Ahnung, wie sie zu beheben. Ich denke, es hat etwas mit Postgres zu tun.
ich getan habe:
$ mix ecto.create
$ mix ecto.migrate
C:\Users\999\Documents\elixir_files\blog>mix ecto.create
** (RuntimeError) could not find executable `psql` in path, please guarantee it is available before running ecto commands
lib/ecto/adapters/postgres.ex:105: Ecto.Adapters.Postgres.run_with_psql/2
lib/ecto/adapters/postgres.ex:82: Ecto.Adapters.Postgres.storage_up/1
lib/mix/tasks/ecto.create.ex:32: Mix.Tasks.Ecto.Create.run/1
(mix) lib/mix/cli.ex:55: Mix.CLI.run_task/2
(stdlib) erl_eval.erl:669: :erl_eval.do_apply/6
(elixir) lib/code.ex:131: Code.eval_string/3
C:\Users\999\Documents\elixir_files\blog>mix ecto.migrate
[warning] the :size option when configuring Blog.Repo is deprecated, please use :pool_size instead
** (exit) exited in: GenServer.call(#PID<0.139.0>, {:query, "CREATE TABLE IF NOT EXISTS \"schema_migrations\" (\"version\" bigint PRIMARY KEY, \"inserted_at\" timestamp)", []}, :infinity)
** (EXIT) %Postgrex.Error{message: "tcp connect: econnrefused", postgres: nil}
(elixir) lib/gen_server.ex:356: GenServer.call/3
(postgrex) lib/postgrex/connection.ex:102: Postgrex.Connection.query/4
(ecto) lib/ecto/adapters/postgres/connection.ex:31: Ecto.Adapters.Postgres.Connection.query/4
(ecto) lib/ecto/adapters/sql.ex:242: Ecto.Adapters.SQL.query/7
(ecto) lib/ecto/pool.ex:159: Ecto.Pool.do_run/4
(ecto) lib/ecto/adapters/sql.ex:230: Ecto.Adapters.SQL.query/6
(ecto) lib/ecto/adapters/sql.ex:208: Ecto.Adapters.SQL.query/5
(ecto) lib/ecto/adapters/sql.ex:169: Ecto.Adapters.SQL.query!/5
[warning] the :size option when configuring Blog.Repo is deprecated, please use :pool_size instead
[info] GET /posts
[debug] Processing by Blog.PostController.index/2
Parameters: %{"format" => "html"}
Pipelines: [:browser]
[error] GenServer #PID<0.280.0> terminating
Last message: {:"$gen_cast", :connect}
State: %{backend_key: nil, bootstrap: false, extensions: [{Ecto.Adapters.Postgres.DateTime, []}, {Postgrex.Extensions.JSON, [library: Poison]}, {Postgrex.Extensions.Binary, nil}, {Postgrex.Extensions.Text, nil}], listener_channels: #HashDict<[]>, listeners: #HashDict<[]>, opts: [hostname: "localhost", timeout: 5000, otp_app: :blog, repo: Blog.Repo, adapter: Ecto.Adapters.Postgres, username: "postgres", password: "postgres", database: "blog_dev", extensions: [{Ecto.Adapters.Postgres.DateTime, []}, {Postgrex.Extensions.JSON, [library: Poison]}], port: 5432], parameters: %{}, portal: nil, queue: {[%{command: {:connect, [hostname: "localhost", timeout: 5000, otp_app: :blog, repo: Blog.Repo, adapter: Ecto.Adapters.Postgres, username: "postgres", password: "postgres", database: "blog_dev", extensions: [{Ecto.Adapters.Postgres.DateTime, []}, {Postgrex.Extensions.JSON, [library: Poison]}], port: 5432]}, from: nil, reply: :no_reply}], []}, rows: [], sock: nil, state: :ready, statement: nil, tail: "", types: :types_removed, types_key: {'localhost', 5432, "blog_dev", [{Ecto.Adapters.Postgres.DateTime, []}, {Postgrex.Extensions.JSON, [library: Poison]}]}}
** (exit) %Postgrex.Error{message: "tcp connect: econnrefused", postgres: nil}
[info] Sent 500 in 1149ms
[error] #PID<0.278.0> running Blog.Endpoint terminated
Server: localhost:4000 (http)
Request: GET /posts
** (exit) exited in: GenServer.call(#PID<0.280.0>, {:query, "SELECT p0.\"id\", p0.\"title\", p0.\"body\", p0.\"inserted_at\", p0.\"updated_at\" FROM \"posts\" AS p0", []}, 5000)
** (EXIT) %Postgrex.Error{message: "tcp connect: econnrefused", postgres: nil}
Ich bin auf Windows 10. Ich habe Postgres installiert. Reinstalled es einfach und ich bekomme immer noch die gleichen Fehler, wenn ich es tue: '$ Mix ecto.create $ Mix ecto.migrate' – codedownforwhat
@codedownforwhat In diesem Fall - ich würde vermuten, dass die' psql' Binärdatei ist nicht in Ihrem Weg. Fügen Sie das 'bin' -Verzeichnis für Ihre postgres-Installation zu Ihrem Pfad http://www.computerhope.com/issues/ch000549.htm oder http://www.tenforums.com/tutorials/3234-environment-variables-windows-10 hinzu -a..html sollte mit dieser – Gazler
helfen Ich habe die Installation durchgeführt und überprüft, dass der Behälter fertig ist. Ich mache psql -v und bekomme die Version, aber immer noch, wenn ich ecto.migrate-Befehle ausführen, bekomme ich '[Warnung] die Option: size bei der Konfiguration von Blog.Repo ist veraltet, bitte verwenden: pool_size stattdessen' – codedownforwhat