0

When I run rails server, I have the following error:

rails server                                                                                                       
=> Booting WEBrick                                                                                                 
=> Rails 4.0.2 application starting in development on localhost:3000                                          
=> Run `rails server -h` for more startup options                                                                  
=> Ctrl-C to shutdown server                                                                                       
[2013-12-26 23:29:07] INFO  WEBrick 1.3.1                                                                          
[2013-12-26 23:29:07] INFO  ruby 2.0.0 (2013-11-22) [i386-mingw32]                                                 
[2013-12-26 23:29:07] WARN  TCPServer Error: Only one usage of each socket address (protocol/network address/po    
rt) is normally permitted. - bind(2)                                                                               
Exiting                                                                                                            
C:/Ruby200/lib/ruby/2.0.0/webrick/utils.rb:85:in `initialize': Only one usage of each socket address (protocol/    
network address/port) is normally permitted. - bind(2) (Errno::EADDRINUSE)                                         
        from C:/Ruby200/lib/ruby/2.0.0/webrick/utils.rb:85:in `new'                                                
        from C:/Ruby200/lib/ruby/2.0.0/webrick/utils.rb:85:in `block in create_listeners'                          
        from C:/Ruby200/lib/ruby/2.0.0/webrick/utils.rb:82:in `each'                                               
        from C:/Ruby200/lib/ruby/2.0.0/webrick/utils.rb:82:in `create_listeners'                                   
        from C:/Ruby200/lib/ruby/2.0.0/webrick/server.rb:132:in `listen'                                           
        from C:/Ruby200/lib/ruby/2.0.0/webrick/server.rb:113:in `initialize'                                       
        from C:/Ruby200/lib/ruby/2.0.0/webrick/httpserver.rb:45:in `initialize'                                    
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `new'                
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `run'                
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'                      
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands/server.rb:84:in `start'         
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (req    
uired)>'                                                                                                           
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'                  
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'     
        from bin/rails:4:in `require'                                                                              
        from bin/rails:4:in `<main>'   

5 Answers 5

1

If you have a problem using the default port, try another port.

For example:

rails server -p 4000
Sign up to request clarification or add additional context in comments.

1 Comment

hi, i followed exactly what was explained in the rails4 todo lists tutorial here at treehouse on how to install rpec, but i didnt have the directories helpers,views, controller, and the rest, pls how can i generate theses directories,thanks
0

Since you mention you are running Windows and using vagrant, I'll make the assumption that vagrant is running a POSIX based operating system such as Debian, CentOS, etc.

You should ssh into the vagrant machine and find the process of the WEBrick server that is running and terminate it. You may need to do sudo if the instance was started by a process or job having a different UID than your user.

To find a process id to kill you can use ps. However since you know the port that is being used, you could use fuser with the -k flag as well.

fuser -k 3000/tcp

or

sudo fuser -k 3000/tcp

or any of the following:

Rails server says port already used, how to kill that process?

If you require sudo and you are not in the sudoers file and cannot su to root (don't know the password) or access the user or group that started the process, contact whomever set you up with the vagrant instance and ask how you can have your credentials added to sudoers.

Comments

0

Make sure you have no other Rails servers running.

Comments

0

There is another process running on the same port.

If that's a webrick, Try killall -9 ruby and check again.

3 Comments

am on a windows machine using vagrant, its says killall is nor a valid command
Right, I didn't notice that. Kill the process with process manager then.
well am using virtual box and i dont see any ruby or rails stuff running, i dont know if am looking at the right thing or not.thanks
0

To Ensure that no rails server is running now, you need to do something like this:

Go App root directory -> tmp -> pids and then delete server.pid

It will ensure that no process is runing for your server and then restart your server once again.

  1. Or you can run your rails server by using another port if u need then run the bellow command in the terminal or command prompt:

                           rails server -p 5000
    
  2. Or you may try this :

                          lsof -wni tcp:3000
    

And then kill the process, collect PID from the result of above command:

                           kill -9 PID

1 Comment

hi, i followed exactly what was explained in the rails4 todo lists tutorial here at treehouse on how to install rpec, but i didnt have the directories helpers,views, controller, and the rest, pls how can i generate theses directories,thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.