加载“postgresql”Active Record 适配器时出错。缺少它所依赖的宝石? pg 不是捆绑包的一部分。将其添加到您的 Gemfile

问题描述 投票:0回答:3

宝石档案

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
Ruby '2.3.3'
gem 'rails', '~> 5.2.1'
gem 'bootstrap-sass', '3.3.7'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'duktape'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
#gem 'redis', '~> 4.0'
gem 'bcrypt', '3.1.12'
#gem 'mini_magick', '~> 4.8'
#gem 'capistrano-rails', group: :development
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
end
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '>= 3.3.0'
end
group :test do
gem 'rails-controller-testing', '1.0.2'
gem 'minitest',                 '5.10.3'
gem 'minitest-reporters',       '1.1.14'
gem 'guard',                    '2.13.0'
gem 'guard-minitest',           '2.4.4'
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
gem 'chromedriver-helper'
end
group :production do
gem 'pg', '0.18.4'
end
gem 'tzinfo-data', platforms: [:mingw,:mswin,:x64_mingw, :jruby]

    source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
uby '2.3.3'
gem 'rails', '~> 5.2.1'
gem 'bootstrap-sass', '3.3.7'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'duktape'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
#gem 'redis', '~> 4.0'
gem 'bcrypt', '3.1.12'
#gem 'mini_magick', '~> 4.8'
#gem 'capistrano-rails', group: :development
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
end
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '>= 3.3.0'
end
group :test do
gem 'rails-controller-testing', '1.0.2'
gem 'minitest',                 '5.10.3'
gem 'minitest-reporters',       '1.1.14'
gem 'guard',                    '2.13.0'
gem 'guard-minitest',           '2.4.4'
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
gem 'chromedriver-helper'
end
group :production do
gem 'pg', '0.18.4'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gemfile
3个回答
24
投票

您可能有一个指向 postgres db 的先前

DATABASE_URL
环境变量集。
DATABASE_URL
覆盖
RAILS_ENV

如果您尚未设置永久,一种选择是退出会话并在新会话中重试

DATABASE_URL

取消设置您的

DATABASE_URL
,您应该会很好。


0
投票

命令行上的“gem install pg”对我有用


0
投票

将其插入到您的 Gemfile 中。

宝石'pg'

© www.soinside.com 2019 - 2024. All rights reserved.