Rails说sqlite3不在gem文件中

时间:2018-02-24 00:43:42

标签: ruby-on-rails ruby

我正在尝试运行rake db:migrate但是我收到了很多错误,如下所示

rake aborted!
Gem::LoadError: 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).
/Users/Aeip/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec'

我确保sqlite3在gem文件中,并确保在database.yml上指定哪些用于开发和生产,但仍然会出现此错误。我的宝石文件

group :development, :test do
    gem 'sqlite3'
end

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

的database.yml

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

1 个答案:

答案 0 :(得分:0)

尝试运行bundle install rake db:migratebin/rails db:migrate。这些命令应确保您的捆绑包已正确加载到GEM_PATH