2013-03-10 100 views
1

我有一個問題,當我嘗試運行使用軌小號不能運行Rails服務器

我使用Windows的服務器,這是回報:

C:\Blog\MyBlog>rails s 
=> Booting WEBrick 
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
Exiting 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:353:in `kill': Invalid argument (Errno::EINVAL) 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:353:in `pidfile_process_status' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:340:in `check_pid!' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:246:in `start' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in <top (required)>' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>' 
     from script/rails:6:in `require' 
     from script/rails:6:in `<main>' 

C:\Blog\MyBlog> 

我的Gemfile :

源 'https://rubygems.org'

gem 'rails', '3.2.12' 

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

gem 'sqlite3' 


# Gems used only for assets and not required 
# in production environments by default. 
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' 

# To use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.0.0' 

# To use Jbuilder templates for JSON 
# gem 'jbuilder' 

# Use unicorn as the app server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'debugger' 

紅寶石 1.9.3p392(2013年2月22日)[I386-的mingw32],Rails的 3.2.12,寶石 25年8月1日

對不起,我的英語的人

EDITED

我嘗試使用的雜種狗,但我得到在cmd下一個:

C:\Blog\MyBlog>rails s mongrel 
Exiting 
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/handler/mongrel.rb:1:in 
`require': cannot load such file -- mongrel (LoadError) 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/handler/mon 
grel.rb:1:in `<top (required)>' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/handler.rb: 
20:in `const_get' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/handler.rb: 
20:in `block in get' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/handler.rb: 
20:in `each' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/handler.rb: 
20:in `inject' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/handler.rb: 
20:in `get' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:2 
72:in `server' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/comma 
nds/server.rb:59:in `start' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/comma 
nds.rb:55:in `block in <top (required)>' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/comma 
nds.rb:50:in `tap' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.12/lib/rails/comma 
nds.rb:50:in `<top (required)>' 
     from script/rails:6:in `require' 
     from script/rails:6:in `<main>' 
+0

用'bundle'沒有問題? – 2013-03-10 00:43:31

+0

也許它可以幫助你: http://pullmonkey.com/2008/02/19/errno-einval-invalid-argument/ – rbinsztock 2013-03-10 00:52:35

+0

我做了'捆綁安裝',但沒有改變,如果是你說的,我看到你說什麼,senayar,但事實並非如此,我沒有使用任何所謂的'雜種'...對不起,我是一個新手所有這一切(紅寶石,並ror) – 2013-03-10 01:12:48

回答

2

Windows和Rails在其他環境中通常不起作用。最佳解決方法帶Rails的Windows中的Webbrick問題是安裝另一臺服務器進行開發。 Mongrel是一個很好的選擇。要安裝它:

gem install mongrel 

然後啓動服務器

rails s mongrel 
+0

我有一個問題,該選項。我將用這些信息編輯問題。 – 2013-03-10 01:51:41

+0

試着把'gem mongrel'放進你的Gemfile中。 – Pigueiras 2013-03-10 12:07:55

+0

「C:/Ruby193/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:12:在'require'中:126:沒有任何文件可以在encontrar elmódulo - C:/ Ruby193/ lib/ruby​​/gems/1.9.1/gems/mongrel-1.1.5-x86-mingw32/lib/http11.so(LoadError)「...我把」gem'mongrel' 「在我的gemfile上,但這就是我得到的...(Windows是西班牙語,對不起) – 2013-03-10 18:34:18

4

嘗試添加隨機沒有到TMP /的PID/server.pid文件,然後啓動(如爲,6532。) webricks

+0

這適用於我。謝謝!我在Windows 7上使用Ruby 2.1和Rails 4.1。 – Sithu 2015-10-20 16:23:55