我知道在Windows上运行ruby on rails有很多问题但是在我得到一台运行Linux或OSx的新笔记本电脑之前我做不了多少。
这是我随机面对的另一个问题。经过大量的试验和错误,我上次能够修复它,所以我现在忘记了如何解决它。 这是我到目前为止所做的事情,
Ran rails生成控制器StaticPages主页帮助 一切都很好。我看到创建了新的静态页面,但是当我运行rails服务器并点击localhost:3000 / static_pages / home时,我在浏览器响应中看到以下错误,
在2015-02-28 15:21:13 +1100
开始获取127.0.0.1的“/ static_pages / home”LoadError (Could not load 'active_record/connection_adapters/sqlite3_adapter'. M
ake 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 adapt
er gem to the Gemfile.):
activesupport (4.2.0) lib/active_support/dependencies.rb:274:in `require'
activesupport (4.2.0) lib/active_support/dependencies.rb:274:in `block in requ
ire'
activesupport (4.2.0) lib/active_support/dependencies.rb:240:in `load_dependen
activesupport(4.2.0)lib / active_support / dependencies.rb:274:in require'
activerecord (4.2.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:
6:in
'
activesupport(4.2.0)lib / active_support / dependencies.rb:274:在require'
activesupport (4.2.0) lib/active_support/dependencies.rb:274:in
块中的requ
愤怒”
activesupport(4.2.0)lib / active_support / dependencies.rb:240:in load_dependen
cy'
activesupport (4.2.0) lib/active_support/dependencies.rb:274:in
require'
activerecord(4.2.0)lib / active_record / connection_adapters / connection_specific
ation.rb:175:在spec'
activerecord (4.2.0) lib/active_record/connection_handling.rb:50:in
建立
_连接'
activerecord(4.2.0)lib / active_record / railtie.rb:120:in block (2 levels) in
<class:Railtie>'
activesupport (4.2.0) lib/active_support/lazy_load_hooks.rb:38:in
instance_ev
人”
activesupport(4.2.0)lib / active_support / lazy_load_hooks.rb:38:in execute_hoo
k'
activesupport (4.2.0) lib/active_support/lazy_load_hooks.rb:45:in
块中的ru
n_load_hooks'
activesupport(4.2.0)lib / active_support / lazy_load_hooks.rb:44:in each'
activesupport (4.2.0) lib/active_support/lazy_load_hooks.rb:44:in
run_load_ho
OKS'
activerecord(4.2.0)lib / active_record / base.rb:316:in <module:ActiveRecord>'
activerecord (4.2.0) lib/active_record/base.rb:26:in
'
activerecord(4.2.0)lib / active_record / migration.rb:384:in connection'
activerecord (4.2.0) lib/active_record/migration.rb:371:in
call'
actionpack(4.2.0)lib / action_dispatch / middleware / callbacks.rb:29:in block in
call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in
call'
activesupport(4.2.0)lib / active_support / callbacks.rb:88:in _run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in
_ run_call_callba
中正
activesupport(4.2.0)lib / active_support / callbacks.rb:81:in run_callbacks'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in
call'
actionpack(4.2.0)lib / action_dispatch / middleware / reloader.rb:73:in call'
actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:in
call'
actionpack(4.2.0)lib / action_dispatch / middleware / debug_exceptions.rb:17:in c
all'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in
ca
二'
railties(4.2.0)lib / rails / rack / logger.rb:38:in call_app'
railties (4.2.0) lib/rails/rack/logger.rb:20:in
阻止通话'
activesupport(4.2.0)lib / active_support / tagged_logging.rb:68:in block in tag
ged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in
tagged'
activesupport(4.2.0)lib / active_support / tagged_logging.rb:68:in tagged'
railties (4.2.0) lib/rails/rack/logger.rb:20:in
call'
actionpack(4.2.0)lib / action_dispatch / middleware / request_id.rb:21:in call'
rack (1.6.0) lib/rack/methodoverride.rb:22:in
call'
rack(1.6.0)lib / rack / runtime.rb:18:in call'
activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware
.rb:28:in
call'
rack(1.6.0)lib / rack / lock.rb:17:in call'
actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in
call'
rack(1.6.0)lib / rack / sendfile.rb:113:in call'
railties (4.2.0) lib/rails/engine.rb:518:in
call'
railties(4.2.0)lib / rails / application.rb:164:in call'
rack (1.6.0) lib/rack/lock.rb:17:in
call'
rack(1.6.0)lib / rack / content_length.rb:15:在`call'
rack (1.6.0) lib/rack/handler/webrick.rb:89:in `service'
C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `s
ervice'
C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `ru
n'
C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block
in start_thread'
Rendered C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4
.2.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (1.0ms)
Rendered C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4
.2.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (5.0ms)
Rendered C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4
.2.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html
.erb (1.0ms)
Rendered C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4
.2.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb withi
n rescues/layout (58.0ms)
这里有一个类似的问题Could not load 'active_record/connection_adapters/sqlite3_adapter',但提出问题的人不接受解决方案。我也试过了,它对我不起作用。
的Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'sass-rails', '5.0.1'
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
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
#gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
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'
end
Gemfile.lock的
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.0)
activesupport (= 4.2.0)
globalid (>= 0.3.0)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
arel (~> 6.0)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
ansi (1.5.0)
arel (6.0.0)
builder (3.2.2)
byebug (3.4.0)
columnize (~> 0.8)
debugger-linecache (~> 1.2)
slop (~> 3.6)
celluloid (0.16.0)
timers (~> 4.0.0)
coderay (1.1.0)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.9.1)
columnize (0.9.0)
debugger-linecache (1.2.0)
erubis (2.7.0)
execjs (2.3.0)
ffi (1.9.6-x86-mingw32)
formatador (0.2.5)
globalid (0.3.3)
activesupport (>= 4.1.0)
guard (2.12.4)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-minitest (2.3.1)
guard (~> 2.0)
minitest (>= 3.0)
hike (1.2.3)
hitimes (1.2.2-x86-mingw32)
i18n (0.7.0)
jbuilder (2.2.3)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (4.0.3)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.2)
listen (2.8.5)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
loofah (2.0.1)
nokogiri (>= 1.5.9)
lumberjack (1.0.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (2.4.3)
mini_backtrace (0.1.3)
minitest (> 1.2.0)
rails (>= 2.3.3)
mini_portile (0.6.2)
minitest (5.5.1)
minitest-reporters (1.0.5)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
multi_json (1.10.1)
nenv (0.2.0)
nokogiri (1.6.6.2-x86-mingw32)
mini_portile (~> 0.6.0)
notiffany (0.0.6)
nenv (~> 0.1)
shellany (~> 0.0)
pg (0.17.1-x86-mingw32)
pry (0.10.1-x86-mingw32)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
win32console (~> 1.3)
rack (1.6.0)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.0)
actionmailer (= 4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
activemodel (= 4.2.0)
activerecord (= 4.2.0)
activesupport (= 4.2.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.5)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.1)
loofah (~> 2.0)
rails_12factor (0.0.2)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.4)
rails_stdout_logging (0.0.3)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (4.2.0)
json (~> 1.4)
ruby-progressbar (1.7.1)
sass (3.4.13)
sass-rails (5.0.1)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1)
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
shellany (0.0.1)
slop (3.6.0)
spring (1.1.3)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.9-x86-mingw32)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (4.0.1)
hitimes
turbolinks (2.3.0)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2015.1)
tzinfo (>= 1.0.0)
uglifier (2.5.3)
execjs (>= 0.3.0)
json (>= 1.8.0)
win32console (1.3.2-x86-mingw32)
PLATFORMS
x86-mingw32
DEPENDENCIES
byebug (= 3.4.0)
coffee-rails (= 4.1.0)
guard-minitest (= 2.3.1)
jbuilder (= 2.2.3)
jquery-rails (= 4.0.3)
mini_backtrace (= 0.1.3)
minitest-reporters (= 1.0.5)
pg (= 0.17.1)
rails (= 4.2.0)
rails_12factor (= 0.0.2)
sass-rails (= 5.0.1)
sdoc (= 0.4.0)
spring (= 1.1.3)
sqlite3 (= 1.3.9)
turbolinks (= 2.3.0)
tzinfo-data
uglifier (= 2.5.3)
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
更新: rails s命令现在抛出此异常,
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x86-mingw32/l
ib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (L
oadError)
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-
x86-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-
x86-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in `each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in `block in require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in `each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler.rb:133:in `require'
from C:/RailsInstaller/work/sample_app/config/application.rb:7:in `<top
(required)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.0
/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
感谢有人可以帮助我...
答案 0 :(得分:0)
问题似乎与你正在使用的sqlite3版本有关。试试
.crt
而不是
gem 'sqlite3', '>= 1.3.9'