2013-08-16 20 views
5

我想在我的筆記本上安裝ROR(Debian Wheezy 64位)。無法加載'active_record/connection_adapters/sqlite3_adapter'

首先我有這個問題(enter link description here)由第一個答案解決。

現在鐵軌服務器啓動,但衝浪在本地主機的瀏覽器:3000我得到以下錯誤:

Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.

我已經安裝了Ruby 2.0.0編譯源代碼,沒有任何錯誤或失誤。 然後,我已經安裝了一些必要的庫(sqlite3的,libsqlite3-DEV)...

這裏是我的Gemfile:

'https://rubygems.org' 

-# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.0.0' 

-# Use sqlite3 as the database for Active Record 
gem 'sqlite3' 

-# Use SCSS for stylesheets 
gem 'sass-rails', '~> 4.0.0' 

-# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 

-# Use CoffeeScript for .js.coffee assets and views 
gem 'coffee-rails', '~> 4.0.0' 

-# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
-# gem 'therubyracer', platforms: :ruby 

-# Use jquery as the JavaScript library 
gem 'jquery-rails' 

-# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 

-# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 1.2' 

group :doc do 
    -# bundle exec rake doc:rails generates the API under doc/api. 
    gem 'sdoc', require: false 
end 

-# Use ActiveModel has_secure_password 
-# gem 'bcrypt-ruby', '~> 3.0.0' 

-# Use unicorn as the app server 
-# gem 'unicorn' 

-# Use Capistrano for deployment 
-# gem 'capistrano', group: :development 

-# Use debugger 
-# gem 'debugger', group: [:development, :test] 

gem 'execjs' 
gem 'therubyracer' 

而且在我的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 

我寶石版本:

ruby 2.0.0 
rails 4.0.0 
sqlite 1.3.7 
+0

只是爲了檢查你是否正確安裝包?你遵循什麼步驟來安裝捆綁軟件?只是嘗試使用gem install sqlite3 –

+0

是的我安裝sqlite3使用apt-get安裝sqlite3,併爲寶石我使用gem install sqlite3 ... – user2010955

回答

0

我今天剛剛努力過。創建或耙分貝:試圖運行耙分貝時,我的錯誤遷移或運行的服務器略有不同:

/Users/lisa/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': Could not load 'active_record/connection_adapters/sqlite_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError) 

注意,它試圖加載sqlite_adapter,不sqlite3_adapter,儘管我的database.yml文件是有效的,並且確實有'sqlite3'。我對我的database.yml做了各種各樣的事情,這讓我意識到無論我嘗試什麼(例如postgresql),rails仍然試圖加載sqlite。我終於看了看周圍的東西,這是壓倒一切的database.yml,並發現它:

$ env | grep sqlite 

DATABASE_URL=sqlite:////Users/lisa/dev/mango/devdb.sqlite 

這是使用Django玩弄,被搞砸了我的Rails環境設置。哎喲。

12

當運行rake db:create_migration時,遇到了今天在Sinatra玩弄的這個錯誤。我的錯誤是錯誤地在app.rb中指定了「sqlite:」數據庫類型,當它應該是「sqlite :」。例如:

錯誤:

set :database, 'sqlite:name.db' 

正確:

set :database, 'sqlite3:name.db' 
+0

也經歷了與Sinatra這個問題 - 謝謝! – Anconia

+0

剛剛遇到同樣的問題,這正是我正在尋找的。當它發生時喜歡它,謝謝發佈! – dannyk