我正在尝试rails db:create
为我的 rails 5.0.0.1 应用程序创建一个数据库,但收到以下错误:
Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
关键是我的 Gemfile 中有一个gem 'pg'
,它由bundle update
1.0.0 更新到 1.0.0 版,在bundle install
之后启动:
$ gem list
...
pg (1.0.0, 0.20.0)
我不知道为什么 rails 无法识别已安装的 pg gem 并且无法为我的应用程序创建数据库。
PG 版本 1.0.0 在 Rails 5.1.5 及更高版本上工作正常。 查看此 github 帖子