简体   繁体   English

无法将Rails应用程序部署到heroku

[英]failed to deploy rails app to heroku

I am trying to deploy my rails app to heroku but but the following message in my heroku log: 我正在尝试将rails应用程序部署到heroku,但是在我的heroku日志中却显示以下消息:

/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add /app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188 rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem'sqlite3'` rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add到您的Gemfile中(并确保其版本为ActiveRecord要求的最低版本)。 (Gem::LoadError) (Gem :: LoadError)

this is my Gemfile: 这是我的Gemfile:

source 'https://rubygems.org'


gem 'rails', '5.1.4'
gem 'puma', '3.9.1'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.7.0'
gem 'rails-ujs'


group :development, :test do
  gem 'sqlite3', '1.3.13'
  gem 'byebug', '9.0.6', platform: :mri
end

group :development do
  gem 'web-console', '3.5.1'
  gem 'listen', '3.1.5'
  gem 'spring', '2.0.2'
  gem 'spring-watcher-listen', '2.0.1'
end

group :production do 
  gem 'pg', '0.20.0'
end

I've tried using the specific version of sqlite3 and the general one that uses the most recent version and neither one works. 我试过使用sqlite3的特定版本和使用最新版本的通用版本,但都无法使用。

goodjobbin85, it means, you need to move gem 'sqlite3' from group :development, :test to group :development goodjobbin85,这意味着您需要将gem'sqlite3 gem 'sqlite3'group :development, :test移至group :development

if it fails in new deploy, try remove Gemfile.lock, do new bundle and git add/commit/push 如果在新的部署中失败,请尝试删除Gemfile.lock,执行新的bundle然后git add/commit/push

It looks like you have mentioned sqlite as database adapter for production. 您似乎已经提到sqlite作为用于生产的数据库适配器。 If this is the case, you have to change it to postgresql . 如果是这种情况,则必须将其更改为postgresql In config/database.yml , change the adapter from config/database.yml ,将适配器从

default: &default
  adapter: sqlite3

to

default: &default
  adapter: postgresql

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM