Rails server doesn't start.

error contents

When trying to start the server with rails s, the following error occurs.

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

I get angry when port 3000 is used.

Let's check the process of the server that is currently running.

$ ps aux | grep puma

The process of 30254 seems to be in the way. The process of 26491 is the process of the ps aux | grep puma command itself.

shiro            30254   0.0  0.1  4455312  15532   ??  S     2:03PM   0:05.23 puma 3.12.6 (tcp://localhost:3000) [portfolio_01]
shiro            26491   0.0  0.0  4258892    224 s000  R+    9:53PM   0:00.00 grep --color=auto puma

Kill the process.

$ kill 30254

Other (launch on another port)

A quick way to solve it. I can't recommend it because it's not a fundamental solution, but if you type the following, it will start up in another port.

$ rails s -p 3001

At the end

I spent a lot of time on this error when setting up Rails and so on. I will post it in the hope that it will be useful for beginners like me. Please refer.

Recommended Posts

Rails server doesn't start.
Start Rails Tutorial
What to do if the Rails server can't start
When the server does not start with rails s
Rails web server and application server
[Beginner] When rails s doesn't work
[Rails] Save start time and end time
mysql doesn't start up with docker.
Visualize Rails server processing time using Server Timing
SCSS doesn't work when deploying Rails6 AWS
Rails API server environment construction using docker-compose
[heroku] run rails db: migrate doesn't work
What to do if the rails server doesn't run out on AWS cloud9