Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keep getting "? Something is already running on port 3000" when I do npm start on react app

I keep on getting "? Something is already running on port 3000" message in my terminal when I start up my react server when there is absolutely nothing running on my port 3000

What I have tried to solve with:

  1. Restart the macOS.
  2. checking my "http://localhost:3000" on chrome browser. (Nothing: This site can’t be reached)
  3. Go to chrome://serviceworker-internals and chrome://appcache-internals, search for localhost:3000 (Nothing found)
  4. I also tried almost every command lines I found on Google regarding this issue
  5. I also created another express.js app, and it was successfully launch on port 3000 while React said there is something running on 3000. React on my computer just keeping thinking there is something running on port 3000.

terminal

Chrome

like image 381
Jonathan Lee Avatar asked Feb 28 '18 05:02

Jonathan Lee


People also ask

How do I stop port 3000 already in use?

You can stop process with ctrl+C in the terminal window.

How do I change the port for running React app?

To change the default port for a create-react-app project, update the start command in your package. json file to specify the port, e.g. "PORT=3456 react-scripts start" on macOS and Linux and "set PORT=3456 && react-scripts start" on Windows.


2 Answers

If you are a windows user you can try using

npx kill-port 3000 

in your console. I was having the same problem and it worked for me.

Not sure about MAC.

like image 109
Vaibhav Avatar answered Sep 20 '22 10:09

Vaibhav


Open cmd and write this

netstat -a -o -n

You will get list of active connections then find 3000 by hitting

Cntrl + f

enter image description here

Copy the PID of that port and hit this command

taskkill /F /PID PID_of_port

enter image description here

Edit This guide is for windows.

like image 39
Muneeb Avatar answered Sep 20 '22 10:09

Muneeb