I'm trying to get started with Ruby on Rails, and it's all gone quite well up until I try to start the server. I get the following error:
C:\Users\Ken\workspace\railsHello>rails server
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d 开发者_C百科to detach
=> Ctrl-C to shutdown server
[2011-03-10 19:53:08] INFO WEBrick 1.3.1
[2011-03-10 19:53:08] INFO ruby 1.9.2 (2011-02-18) [i386-mingw32]
[2011-03-10 19:53:09] WARN TCPServer Error: not a socket file descriptor
Exiting
C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:73:in `initialize': not a socket file
descriptor (ArgumentError)
from C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:73:in `new'
from C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:73:in `block in create_l
isteners'
from C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:70:in `each'
from C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:70:in `create_listeners'
from C:/Ruby192/lib/ruby/1.9.1/webrick/server.rb:74:in `listen'
from C:/Ruby192/lib/ruby/1.9.1/webrick/server.rb:62:in `initialize'
from C:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:24:in `initialize'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/handler/web
rick.rb:10:in `new'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/handler/web
rick.rb:10:in `run'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:2
13:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/comman
ds/server.rb:65:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/comman
ds.rb:30:in `block in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/comman
ds.rb:27:in `tap'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/comman
ds.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
C:\Users\Ken\workspace\railsHello>
I don't even know where to start with "TCPServer Error: Not a socket file descriptor."
Trying it through Aptana didn't help either.
I'm on Windows 7 Home Premium. Apache was already installed, but I shut it down and it didn't make a difference.
Thanks in advance for your help!
-Ken
Are you sure nothing else is listening on port 3000 (perhaps an old instance of the server that didn't get shut down)? Check the following:
netstat -a -b
If there is, simply kill that application, or start WEBrick on another port; for example, to start it on port 8000:
rails server --port=8000
精彩评论