[RUBY] Resolve the Address already in use error

Event

When I try to start the server with rails s, I get an error and the server cannot start. Error: "port3000 is already in use"

`initialize': Address already in use - bind(2) for "127.0.0.1" port 3000 (Errno::EADDRINUSE)

Cause

The port3000 you want to use is being used by an old process in the past and is preventing the new process from starting the server.

Remedy: Eliminate the batting of the used port

  1. Check the process (PID) where the port number where the error is occurring is used
mao-no-MacBook-Air:hello_world_sample mao$ lsof -i:3000
COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
ruby    30406  mao   12u  IPv4 0x982d8086b787a0bb      0t0  TCP localhost:hbci (LISTEN)
ruby    30406  mao   13u  IPv6 0x982d8086b93685bb      0t0  TCP localhost:hbci (LISTEN)
  1. Delete the started process
mao-no-MacBook-Air:hello_world_sample mao$ kill 30406
  1. Reboot the server and check that there are no errors
mao-no-MacBook-Air:hello_world_sample mao$ rails s
/Users/mao/.rbenv/versions/2.7.1/lib/ruby/2.7.0/x86_64-darwin17/stringio.bundle: warning: already initialized constant StringIO::VERSION
=> Booting Puma
=> Rails 6.0.3.2 application starting in development 
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 4.3.5 (ruby 2.7.1-p83), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://127.0.0.1:3000
* Listening on tcp://[::1]:3000
Use Ctrl-C to stop

Recommended Posts

Resolve the Address already in use error
· Address already in use solution
Date of Address already in use error in Flask
Error in Flask OSError: [Errno 98] Address already in use
The day you killed the process (flask gave an error saying Address already in use)
[PyMC3] Resolve the Compilation Failed error
If you get Error: That port is already in use. In Django
Use the type features evolved in Sphinx-2.4
Get the client's IP address in Django
The story of an error in PyOCR
Dictionary key error → Resolve with key in dicionary
Use the command previously entered in IDLE
How to use the C library in Python
Use the LIKE clause in golang x SQLite3
Use the latest pip in a virtualenv environment
Resolve Japanese write error UnicodeEncodeError in Python files
Error in random.shuffle
Error in Pyinstaller
Use a custom error page in python / tornado
Error in TensorBoard
Use the LibreOffice app in Python (3) Add library
Use pygogo to get the log in json.
Use the CASA Toolkit in your own Python environment
How to use the exists clause in Django's queryset
Let's use the open data of "Mamebus" in Python
How to use the model learned in Lobe in Python
I want to use the R dataset in python
I can't use the darknet command in Google Colaboratory!
Use DataFrame in Java
Use dates in Python
Use Mean in DataFrame
Use Valgrind in Python
Use ujson in requests
Error handling in PythonBox
Use profiler in Python
zipimporter error in pyramid
Examine the margin of error in the number of deaths from pneumonia
Survey on the use of machine learning in real services
How to use the __call__ method in a Python class
Notes on how to use marshmallow in the schema library