0

我正在使用 git 和 Heroku 构建一个简单的 Ruby on Rails,用于版本控制和部署。这是我正在使用的基本大纲:

rails ne test_app

cd test_app

git add .

git commit -, “initial install”

heroku create

I modify the gemfile to get the sql out of production

I add gem pg to production

bundle install

rails generate test_app (with credentials)

git add .

git commit -m “updated”

git push heroku master

一切看起来都很好,然后我得到以下信息:

remote: -----> Installing node-v6.11.1-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        Gem::LoadError: 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).

远程:/tmp/build_cfee4fae63659bd06c3737f67849dc42/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in rescue in spec' remote: /tmp/build_cfee4fae63659bd06c3737f67849dc42/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:185:inspec'

这是我正在使用的:

ruby 2.4.3p205 (2017-12-14 revision 61247) [x64-mingw32]
rails 5.1.4
4

1 回答 1

0

通过使用以下内容更新 gemfile 来修复:

group :production do gem 'pg', '~> 0.20' gem 'rails_12factor' end

于 2018-02-13T15:31:10.910 回答