【发布时间】:2022-11-08 15:21:40
【问题描述】:
我正在尝试在 termux 中使用 ruby on rails 创建一个应用程序,我已经为设置安装了必要的 gem 和包,但是在执行 rails db:create 时。我收到这个错误
rails aborted!
ActiveRecord::ConnectionNotEstablished: connection to server on socket "/data/data/com.termux/files/usr/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Caused by:
PG::ConnectionBad: connection to server on socket "/data/data/com.termux/files/usr/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
【问题讨论】:
-
错误消息的性质表明 postgresql 未在该虚拟环境中运行或具有过时的 PID。如果您在过去的某个时间启动它,然后断开连接,然后返回,则 postgres 可能已挂起/终止。您应该能够 tmux attach 然后
psql $whatever_your_database_is_called,如果您收到错误,您会知道这与 rails 无关,而是与 postgres 有关
标签: ruby-on-rails ruby postgresql termux termux-linux