Ruby on rails 无法加载';活动记录/连接适配器/sqlite3适配器';。Windows 7本地服务器

Ruby on rails 无法加载';活动记录/连接适配器/sqlite3适配器';。Windows 7本地服务器,ruby-on-rails,ruby,windows,Ruby On Rails,Ruby,Windows,我一直在学习Rails教程,前两章很顺利。我在笔记本电脑上安装了Rails,制作了一个hello world应用程序和一个带有脚手架生成器的玩具。有些事情我不得不做得不同,因为我在本地而不是在云环境中做每件事,因为我使用的是Windows7,但我让每件事都能正常工作 当我尝试运行本地服务器并转到我的页面时,标题中出现了错误。以下是完整的错误消息: 无法加载“活动\u记录/连接\u适配器/sqlite3\u适配器”。确保config/database.yml中的适配器有效。如果使用的适配器不是“m

我一直在学习Rails教程,前两章很顺利。我在笔记本电脑上安装了Rails,制作了一个hello world应用程序和一个带有脚手架生成器的玩具。有些事情我不得不做得不同,因为我在本地而不是在云环境中做每件事,因为我使用的是Windows7,但我让每件事都能正常工作

当我尝试运行本地服务器并转到我的页面时,标题中出现了错误。以下是完整的错误消息:

无法加载“活动\u记录/连接\u适配器/sqlite3\u适配器”。确保config/database.yml中的适配器有效。如果使用的适配器不是“mysql”、“mysql2”、“postgresql”或“sqlite3”,请将必要的适配器gem添加到gem文件中

我想这一定是Gemfile的问题,因为这是这个应用程序与我的其他应用程序之间的唯一区别,我只是不确定要更改什么。我包括了Gemfile和database.yml。提前谢谢

#Gemfile - sample_app
source 'https://rubygems.org'

gem 'rails',                   '4.2.2'
gem 'bcrypt-ruby', :require => 'bcrypt'
gem 'faker',                   '1.4.2'
gem 'carrierwave',             '0.10.0'
gem 'mini_magick',             '3.8.0'
gem 'fog',                     '1.23.0'
gem 'will_paginate',           '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'bootstrap-sass',          '3.2.0.0'
gem 'sass-rails',              '5.0.2'
gem 'uglifier',                '2.5.3'
gem 'coffee-rails',            '4.1.0'
gem 'jquery-rails',            '4.0.3'
gem 'turbolinks',              '2.3.0'
gem 'jbuilder',                '2.2.3'
gem 'sdoc',                    '0.4.0', group: :doc

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
  gem 'sqlite3'
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :test do
  gem 'minitest-reporters', '1.0.5'
  gem 'mini_backtrace',     '0.1.3'
  gem 'guard-minitest',     '2.3.1'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
  gem 'puma',           '2.11.1'
end
#Gemfile-示例应用程序
来源'https://rubygems.org'
gem“rails”、“4.2.2”
gem'bcrypt ruby',:require=>bcrypt'
宝石“赝品”,“1.4.2”
宝石“carrierwave”,“0.10.0”
宝石“迷你魔术”,“3.8.0”
宝石“雾”,“1.23.0”
gem“将分页”,“3.0.7”
gem“bootstrap-will_paginate”,“0.0.10”
gem“引导式sass”,“3.2.0.0”
gem'sass-rails','5.0.2'
宝石‘丑’、‘2.5.3’
gem“咖啡轨”,“4.1.0”
gem'jqueryrails','4.0.3'
gem“涡轮链接”,“2.3.0”
gem'jbuilder','2.2.3'
gem“sdoc”,“0.4.0”,组::doc
小组:开发,:测试
#在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台
宝石“比伯”
gem'sqlite3'
#在异常页面上或通过在视图中使用访问IRB控制台
gem“web控制台”,“~>2.0”
结束
#Windows不包括zoneinfo文件,因此捆绑tzinfo数据
gem'tzinfo data',平台:[:mingw,:mswin,:x64_mingw,:jruby]
组:测试do
创业板“迷你测试记者”,“1.0.5”
gem“迷你回溯”,“0.1.3”
gem“guard minitest”,“2.3.1”
结束
小组:生产部
gem‘pg’、‘0.17.1’
gem“rails_12因子”,“0.0.2”
宝石“彪马”,“2.11.1”
结束
Database.yml

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: sqlite3
  pool: 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
#SQLite版本3.x
#gem安装sqlite3
#
#确保在gem文件中定义了SQLite 3 gem
#gem'sqlite3'
#
默认值:&默认值
适配器:sqlite3
游泳池:5
超时:5000
发展:

在gem文件中,指定sqlite3(sqlite3)用于开发和测试,指定postgres(pg)用于生产。 但是在您的database.yml中,您已经将生产数据库指定为sqlite3:

<database.yml>
 ...
production:
  <<: *default
  database: db/production.sqlite3  
(请确保您的计算机上有postgres作为应用程序或服务运行。)

或者,您也可以更改GEM文件,以便在生产中使用SQLite3


如果您试图在Windows计算机上运行生产版本,但可能正在OSX计算机上运行开发或测试版本,这可能就是问题所在。

您运行的是哪个版本的Ruby?在命令提示符下的Ruby-v中显示Ruby 2.1.5P273当您运行
bundle install
时,您能给我们一些输出吗?您是否成功地将SQLite与之前的Ruby程序或教程中的示例一起使用?您看,您是如何测试SQLite是否正常工作以及是否可以访问这些数据库的?([path to your example app]/db/development.sqlite3[path to your example app]/db/test.sqlite3和[path to your example app]/db/production.SQLITE3教程中前面的示例可以正常工作。因此,我卸载了rails并重新安装。然后我使用了其他示例中的GEM文件,这似乎可以正常工作。我不理解这个问题,但确实有效。感谢您的帮助
production:
  adapter: postgresql
  encoding: unicode
  pool: 5
  database: db/production