2013-12-13 51 views
0

我的Gemfile看起來是這樣的:LoadError爲數據庫適配器指定'sqlite3'?

source 'https://rubygems.org' 

gem 'rails', '4.0.2' 
gem 'bootstrap-sass', '2.1.0.0' 
gem 'activesupport', '4.0.2' 
gem 'jquery-rails', '2.0.2' 
gem 'railties', '4.0.2' 
gem 'sass-rails', '4.0.1' 
gem 'coffee-rails', '4.0.1' 
gem 'rails_12factor' 
gem 'actionpack', '4.0.2' 
gem 'sqlite3', '1.3.5' 

group :development, :test do 
    gem 'rspec-rails', '2.11.0' 
    gem 'guard-rspec', '1.2.1' 
    gem 'guard-spork', '1.2.0' 
    gem 'childprocess', '0.3.6' 
    gem 'spork', '0.9.2' 
end 

# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '4.0.1' 
    gem 'coffee-rails', '4.0.1' 
    gem 'uglifier', '1.2.3' 
end 

group :test do 
    gem 'capybara', '1.1.2' 
    gem 'factory_girl_rails', '4.1.0' 
    gem 'cucumber-rails', '1.2.1', :require => false 
    gem 'database_cleaner', '0.7.0' 
    # gem 'launchy', '2.1.0' 
    # gem 'rb-fsevent', '0.9.1', :require => false 
    # gem 'growl', '1.0.3' 
end 

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

我跑bundle installbundle update但是當我訪問本地我的應用程序我得到這個錯誤:

Specified 'sqlite3' for database adapter, but the gem is not loaded. 

Add gem 'sqlite3' to your Gemfile. 

我試圖bundle show sqlite3,我得到/Users/siaW/.rvm/gems/[email protected]_rails_4_0/gems/sqlite3-1.3.5這意味着我做有寶石嗎?

那爲什麼不加載?

在我database.yml我有這樣的:

# SQLite version 3.x 
# gem install sqlite3 
# 
# Ensure the SQLite 3 gem is defined in your Gemfile 
# gem 'sqlite3' 
development: 
    adapter: sqlite3 
    database: db/development.sqlite3 
    pool: 5 
    timeout: 5000 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: sqlite3 
    database: db/test.sqlite3 
    pool: 5 
    timeout: 5000 

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

嘗試從開發組中刪除它。 – BroiSatse

+0

你在哪裏部署?你的服務器是否支持sqlite? – max

+0

@papirtiger本地... – Emanuel

回答

0

我有這個在OSX爲spec/dummy應用。不重建gemset(只是重建sqlite3),它不成功。

我必須做到以下幾點得到一切正常內置:

rvm gemset empty 
brew update 
brew install sqlite 
bundle update 
+0

請不要在多個問題上發佈相同的答案,而應將問題標記爲重複項,並且發佈一個*好*回答* 1個問題的副本。 – meagar

相關問題