Reputation: 1527
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>'
Upvotes: 0
Views: 3059
Reputation: 3374
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.
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
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
Upvotes: 0
Reputation: 1243
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
.
Upvotes: 0
Reputation: 3888
If you have a problem using the default port, try another port.
For example:
rails server -p 4000
Upvotes: 1
Reputation: 2656
There is another process running on the same port.
If that's a webrick, Try killall -9 ruby
and check again.
Upvotes: 0