Ruby on rails Gem::LoadError:加载';sqlite3';活动记录适配器

Ruby on rails Gem::LoadError:加载';sqlite3';活动记录适配器,ruby-on-rails,ruby,heroku,Ruby On Rails,Ruby,Heroku,我正在执行heroku运行rake db:migrate 这就是错误: Gem::LoadError:加载'sqlite3'活动记录适配器时出错。 错过了它所依赖的宝石?sqlite3不是捆绑包的一部分。加上 到你的档案 Gemfile: group :production do gem 'pg', '~> 0.18' end group :development, :test do # Call 'byebug' anywhere in the code to stop exe

我正在执行heroku运行rake db:migrate 这就是错误:

Gem::LoadError:加载'sqlite3'活动记录适配器时出错。 错过了它所依赖的宝石?sqlite3不是捆绑包的一部分。加上 到你的档案

Gemfile:

group :production do
  gem 'pg', '~> 0.18'
end

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end

Rails 5及以下您需要“Rails\u 12factor”gem。。。。轨道5及以上不需要


还注意到,您的开发环境中没有sqlite3,这可能无关紧要,但只需将其放在适当的位置即可。

如果您试图使用sqlite以外的其他数据库

  • 删除gemfile中的sqlite3并进行捆绑安装

  • 删除database.yml中的sqlite3


  • rakedb:create我也遇到了同样的问题,我解决了这个问题,将rails新安装的默认版本降级


    使用“gem卸载sqlite3”删除sqlite3 gem的当前版本,然后修改gem文件以包含sqlite3版本。我在我的案例中设置了版本“~1.3.6”,解决了rails根目录中的问题。

    grep-r sqlite3.
    。您是否添加了
    rails\u 12factor
    gem?您的
    rails\u ENV
    是什么?这是开发还是测试?“5及以下…5及以上”是不明确的。Rails 5是否需要这个gem。事实并非如此。很可能sqlite版本只需要在gem文件中修复:
    gem'sqlite3',“~>1.4.0”
    (或其他版本)您的公式中有一个错误:您暗示Rails 5需要和不需要Rails。我认为版本应该是“~1.3.6”。请改用gem'sqlite3',“~>1.3.6”
    production:
      adapter: postgresql
      encoding: Unicode