After some coding got this error on running rails s
:
Address already in use - bind(2) for "127.0.0.1" port 3000 (Errno::EADDRINUSE)
My environment is:
$ rails -v
Rails 5.0.0
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
I've tried:
lsof -wni tcp:3000
returns me nothingpuma
instead of rails s
- problem solved rails s -p 3001
- same problem, for other ports tooUPDATED
RAILS_ENV=production bundle exec rails s
- problem solved
Any suggestions?
The same process is running somewhere
To see which process used 3000 port and get the process pid type below command
lsof -wni tcp:3000
This will give the process which is using this port
Sample result
process1 12345 0.0 0.0 12343566 1972 s000 R+ 11:17AM 0:00.00 grep puma
You can kill this process by typing below command
12345 this is the process ID
kill -9 12345
Now start server again
The problem appeared because of a bug in Puma's code. Downgrading to the oldest version helped me.
Bug ticket: https://github.com/puma/puma/issues/1022
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With