DEV Community

princecodes247
princecodes247

Posted on

DEV_LOG_1: React scripts something is already running on port 3000

Introduction

Hi guys! I'm a full stack developer and recently I decided to start logging errors, bugs and cool stuff I come across. Today I noticed an error I usually come across from time to time when working with React-scripts or NodeJS.
Something is already running on Port 3000
This is how I usually fix it πŸ§˜πŸΎβ€β™‚οΈ

Step 1: Identify the culprit

Whenever you see this error, it simply means that there's an active process using this port. Usually for me, it's a previous node project that didn't close properly. To identify what it is just use this command.

For windows
netstat -ano | findstr :3000

For Linux (and Mac)
sudo lsof -i tcp:3000

This bring up the running process along with its PID (the number at the end or with PID above it)

Step 2: Kill the culprit

Next we have to end the running process.
For windows
tskill @yourPID@
If you're using git bash then replace tskill with taskkill

For Linux (and Mac...)
sudo kill -9 @yourPID@

@yourPID@ is the PID number you got from the previous command. Also, you should write it all yourself instead of copying and pasting because that usually leads to more errors

You're done! πŸŽ‰

And that's it folks! See you next time and have a Merry Christmas πŸ’ƒπŸΎπŸ’ƒπŸΎπŸ’ƒπŸΎ

Top comments (0)