gpt4 book ai didi

macos - 无法为 Phoenix 运行 postgresql

转载 作者:行者123 更新时间:2023-11-29 14:34:38 25 4
gpt4 key购买 nike

18:37:55.291 [error] GenServer #PID<0.191.0> terminating
** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
(db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Hello.Repo couldn't be created: an exception was raised:
** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
(db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

但我运行了 ~/brew services start postgresql
==>成功启动
postgresql(label: homebrew.mxcl.postgresql)先..

所以我试试

~/locate psql

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

~/ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
/System/Library/LaunchDaemons/com.apple.locate.plist: service already loaded

如何为 Phoenix 启动并运行我的数据库?```

npm install 错误:

```
~/hello/npm install
module.js:538
throw err;
^

Error: Cannot find module 'semver'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
~/hello/
```

最佳答案

创建一个新的 Phoenix 之后:

mix phx.new foo

它告诉你该做什么:

We are almost there! The following steps are missing:

$ cd foo
$ mix deps.get
$ cd assets && npm install && node node_modules/brunch/bin/brunch build

Then configure your database in config/dev.exs and run:

$ mix ecto.create # <----- you need this one

Start your Phoenix app with:

$ mix phx.server

You can also run your app inside IEx (Interactive Elixir) as:

$ iex -S mix phx.server

关于macos - 无法为 Phoenix 运行 postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47064820/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com