2013-09-01 156 views
0

我的工作讓我的第一軌的應用程序,但無論出於何種原因,當我運行命令$軌服務器,我的終端拋出回這個錯誤的軌道服務器:不能在Windows上運行

C:\Sites\blog>rails server 
=> Booting WEBrick 
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
Exiting 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.4/lib/bundler/r 
ubygems_integration.rb:214:in `block in replace_gem': Please install the mysql2 
adapter: `gem install activerecord-mysql2-adapter` (mysql2 is not part of the bu 
ndle. Add it to Gemfile.) (LoadError) 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3 
.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:3:in `<top (requir 
ed)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.13/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.13/lib/active_support/dependencies.rb:251:in `block in require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.13/lib/active_support/dependencies.rb:251:in `require' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3 
.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb 
:50:in `resolve_hash_connection' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3 
.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb 
:41:in `resolve_string_connection' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3 
.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb 
:25:in `spec' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3 
.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb 
:130:in `establish_connection' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3 
.2.13/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.13/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport- 
3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3 
.2.13/lib/active_record/base.rb:720:in `<top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3 
.2.13/lib/active_record/railtie.rb:88:in `block in <class:Railtie>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/initializable.rb:30:in `instance_exec' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/initializable.rb:30:in `run' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/initializable.rb:55:in `block in run_initializers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/initializable.rb:54:in `each' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/initializable.rb:54:in `run_initializers' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/application.rb:136:in `initialize!' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/railtie/configurable.rb:30:in `method_missing' 
     from C:/Sites/blog/config/environment.rb:5:in `<top (required)>' 
     from C:/Sites/blog/config.ru:3:in `require' 
     from C:/Sites/blog/config.ru:3:in `block in <main>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/builder.rb:51:in `instance_eval' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/builder.rb:51:in `initialize' 
     from C:/Sites/blog/config.ru:in `new' 
     from C:/Sites/blog/config.ru:in `<main>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/builder.rb:40:in `eval' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/builder.rb:40:in `parse_file' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/server.rb:200:in `app' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/commands/server.rb:46:in `app' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/server.rb:304:in `wrapped_app' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib 
/rack/server.rb:254:in `start' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/commands/server.rb:70:in `start' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/commands.rb:55:in `block in <top (required)>' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/commands.rb:50:in `tap' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 
3/lib/rails/commands.rb:50:in `<top (required)>' 
     from script/rails:6:in `require' 
     from script/rails:6:in `<main>' 

哪有我解決了這個問題? 我的紅寶石版本:紅寶石1.9.3p392(2013年2月22日)[I386-的mingw32] Rails的版本:3.2.13 寶石--version:1.8.24

+0

請顯示您的Gemfile。 –

回答

1

好吧,讓我們來看看什麼是寫在輸出。

mysql2不是捆綁的一部分。將它添加到Gemfile。

我認爲這意味着mysql2不是捆綁包的一部分,您應該將它添加到Gemfile中以修復此錯誤。

打開Gemfile,向其中添加gem 'mysql2',運行bundle installrake db:create && rake db:migrate,然後bundle exec rails server

+0

感謝DNNX它爲我工作。非常感謝你的幫助... –

相關問題