Rake db:migrate error请安装sqlite3适配器:`gem install activerecord-sqlite3-adapter`

时间:2013-06-06 23:15:54

标签: ruby-on-rails ruby ruby-on-rails-3 heroku dbmigrate

简报:我一直试图将我的博客部署到heroku上一周没有运气。我已经联系了Heroku支持,他们几乎告诉我在stackoverflow上发布日志。所以我在这里。

我很确定它与postgreSQL有关,但我可能错了。无论如何这里是代码库:www.github.com/apane/blogit_blog。

Heroku记录在下面。

Gemfile提供了很好的衡量标准:

source 'https://rubygems.org'

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'blogit', '0.8.0'

gem "will_paginate", "~> 3.0.4"

gem 'devise'

# Gems used only for assets and not required
# in production environments by default.

group :production do
  gem 'pg'
  gem "unicorn", "~> 4.6.2"

end
group :development, :test do
  gem 'pg'
  gem "unicorn", "~> 4.6.2"

end

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

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

  gem 'uglifier', '>= 1.0.3'  
end

gem 'jquery-rails'

Rake db:迁移错误日志:

    rake aborted!
Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.)
/usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/rubygems_integration.rb:147:in `block in replace_gem'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/sqlite3_adapter.rb:3:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:25:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/railtie.rb:74:in `block in <class:Railtie>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/anthonypanepinto/Sites/personal_blog/personal_blog/config/environment.rb:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

3 个答案:

答案 0 :(得分:0)

看起来你可能在开发中使用sqlite。

你可以在你的gemfile中尝试这个而不是你拥有的吗?

group :development, :test do
  gem 'sqlite3'
  gem "unicorn", "~> 4.6.2"

end

然后通常捆绑安装并再次运行迁移。

答案 1 :(得分:0)

错误Please install the sqlite3 adapter: 'gem install activerecord-sqlite3-adapter'表示您的本地环境配置为运行SQLite,但未安装SQLite。该消息引用了activerecord-sqlite3-adapter gem,但是在Gemfile中,在完全集成的Rails环境中,您只需将sqlite3捆绑到您想要运行的环境(可能是开发和测试,因为你的作品是使用Postgres的Heroku。

使用以下内容替换Gemfile中的group :development, test块:

group :development, :test do
  gem 'sqlite3'
  gem "unicorn", "~> 4.6.2"
end

答案 2 :(得分:0)

请记住,Heroku使用配置属性DATABASE_URL而不是database.yml文件来连接到您的数据库。确保它已设置。

heroku config:set DATABASE_URL = sqlite3:// bb06ca765fb123:71b6dabc@us-cdbr-east-04.cleardb.com/heroku_703eded6aebc123?reconnect = true