2017-11-04 14 views
0

먼저 Ruby에 대한 지식 부족과이 게시물 전체에서 특정 용어를 오용 할 가능성이 높습니다. 나는 이것에 극단적으로 새로운이고 나는 간신히 모든 것의 걸림 새를 얻고있다.Odi Project - "sqlite3는 번들의 일부가 아닙니다."

OS : 맥 OS X 엘 카피 탄 어쨌든

, 나는 웹 개발 프로그램을 소개하고 말한다 어디 지점까지 조심스럽게 모든 단계를 다음 봤는데 "오딘 프로젝트"를 다음과 같은거야 터미널

heroku run rails db:migrate 

에서 다음 명령을 실행하고 나는 오류

Running rails db:migrate on ⬢ floating-falls-25848... up, run.9253 (Free) 
rails 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). 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:185:in `spec' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `establish_connection' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:58:in `establish_connection' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railtie.rb:124:in `block (2 levels) in <class:Railtie>' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/base.rb:326:in `<module:ActiveRecord>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/base.rb:25:in `<top (required)>' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/mysql_database_tasks.rb:6:in `<class:MySQLDatabaseTasks>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/mysql_database_tasks.rb:3:in `<module:Tasks>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/mysql_database_tasks.rb:2:in `<module:ActiveRecord>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/mysql_database_tasks.rb:1:in `<top (required)>' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:74:in `<module:DatabaseTasks>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:35:in `<module:Tasks>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:2:in `<module:ActiveRecord>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:1:in `<top (required)>' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railtie.rb:34:in `block (3 levels) in <class:Railtie>' 
/app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:21:in `block in perform' 
/app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:18:in `perform' 
/app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:46:in `invoke' 
/app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>' 
/app/bin/rails:9:in `require' 
/app/bin/rails:9:in `<main>' 

Caused by: 
Gem::LoadError: sqlite3 is not part of the bundle. Add it to your Gemfile. 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/rubygems_integration.rb:377:in `block (2 levels) in replace_gem' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/sqlite3_adapter.rb:10:in `<top (required)>' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:186:in `spec' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `establish_connection' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:58:in `establish_connection' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railtie.rb:124:in `block (2 levels) in <class:Railtie>' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/base.rb:326:in `<module:ActiveRecord>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/base.rb:25:in `<top (required)>' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/mysql_database_tasks.rb:6:in `<class:MySQLDatabaseTasks>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/mysql_database_tasks.rb:3:in `<module:Tasks>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/mysql_database_tasks.rb:2:in `<module:ActiveRecord>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/mysql_database_tasks.rb:1:in `<top (required)>' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:74:in `<module:DatabaseTasks>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:35:in `<module:Tasks>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:2:in `<module:ActiveRecord>' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:1:in `<top (required)>' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' 
/app/vendor/bundle/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railtie.rb:34:in `block (3 levels) in <class:Railtie>' 
/app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:21:in `block in perform' 
/app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands/rake/rake_command.rb:18:in `perform' 
/app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:46:in `invoke' 
/app/vendor/bundle/ruby/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>' 
/app/bin/rails:9:in `require' 
/app/bin/rails:9:in `<main>' 
Tasks: TOP => db:migrate => db:load_config 
(See full trace by running task with --trace) 

이 문제의 원인이 될 수있는 어떤 생각의 무리를 얻으려면? 이것은 무엇을 내 database.ysml 파일의 모습입니다 :

편집

source 'https://rubygems.org' 

git_source(:github) do |repo_name| 
    repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 
    "https://github.com/#{repo_name}.git" 
end 

ruby '2.3.4' 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 5.1.4' 
# Use sqlite3 as the database for Active Record 
group :development, :test do 
    gem 'sqlite3' 
end 

group :production do 
    gem 'pg' 
end 

('sqlite3를'입니다 어디에 코드의 단지 부분을 보여주기 위해) :

이 내 Gemfile 파일의 모습입니다 like :

# SQLite version 3.x 
# gem install sqlite3 
# 
# Ensure the SQLite 3 gem is defined in your Gemfile 
# gem 'sqlite3' 
# 
default: &default 
    adapter: sqlite3 
    pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 
    timeout: 5000 

development: 
    <<: *default 
    database: db/development.sqlite3 

# 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: 
    <<: *default 
    database: db/test.sqlite3 

production: 
    <<: *default 
    database: db/production.sqlite3 
+0

'config/database.yml'을 게시하십시오. 프로덕션 데이터베이스 어댑터로'sqlite3'을 지정했다는 것을 알게 될 것입니다.이 @jvillian – jvillian

+0

는 말씀입니다 : '기본 : 및 기본 어댑터 : sqlite3를 수영장 : <% = ENV.fetch ("RAILS_MAX_THREADS") {5} %> 제한 시간 : 5000 개발 : 를 << : * default 데이터베이스 : db/development.sqlite3 경고 : "rake"를 실행할 때 "test"로 정의 된 데이터베이스가 지워지고 개발 데이터베이스에서 #가 다시 생성됩니다. #이 db를 개발 또는 생산과 동일하게 설정하지 마십시오. 시험 : << : * 기본 데이터베이스 : DB/test.sqlite3 생산 : << : * 기본 데이터베이스 : 읽기가 너무 열심히 dB/production.sqlite3}' – Sweetcharge

+0

귀하의 질문에 추가하십시오이다 주석으로 (올바른 형식으로). 의심되는 것처럼 데이터베이스 어댑터로 postgresql을 지정하지 않으므로 오류가 발생합니다. \ – jvillian

답변

0

데이터베이스 및 어댑터를 config/database.yml에 잘못 설정했습니다. 여기

: 당신은 당신의 기본 데이터베이스 어댑터가 sqlite3를 것을 지정하는

default: &default 
    adapter: sqlite3 
    pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 
    timeout: 5000 

. 그런 다음 제작 과정에서 다음을 수행합니다.

production: 
    <<: *default 
    database: db/production.sqlite3 

adapter: 값을 절대로 지정하지 마십시오. 즉 default에 설정 한 값인 sqlite3을 사용하고 있음을 의미합니다.

또한 프로덕션 환경에서 사용할 데이터베이스가 당연히 정확하지 않은 db/production.sqlite3임을 지정하고 있습니다. 그것이 말하는 방법, adapter: postgresql를 참조

production: 
    <<: *default 
    adapter: postgresql 
    database: contacts_production 
    username: contacts 
    password: <%= ENV['CONTACTS_DATABASE_PASSWORD'] %> 

:

생산 설정은 더 좋아 보일 것이다? 그러면 기본값보다 우선 적용됩니다. 따라서 생산 (Heroku)에서는 대신 postgresql을 사용하도록 구성됩니다.

물론 database:, username:password: (방금 프로젝트 중 하나에서 가져온 것)이 필요합니다. 이것은 정확하게 정확하지 않을 수도 있습니다. 따라서 조금이라도 소란스럽게해야 할 것입니다.

또한 옵션이있는 경우 모든 환경에 대해 postgresql을 사용해야합니다. 데이터베이스는 미묘한 차이점이 있으며, 서로 다른 환경에서 서로 다른 데이터베이스를 사용하여 마음이 편한 것입니다.

+0

당신은 이것을 분류하는 것을 끝내 었 느냐? – jvillian