react-router-tutorial
react-router-tutorial copied to clipboard
Lesson 10 / How to stop webpack server
https://github.com/reactjs/react-router-tutorial/tree/master/lessons/10-clean-urls
Hi there,
On this lesson, we have to reboot webpack dev server. But I killed it on console (using windows > cygwin) and when I lunched "npm start" I got an error for server already running.
I had a look on package.json and there are no other scripts ; Same thing for documentation of webpack, only one mention in comment when a guy had the same problem (on windows 10 too).
So I assume this will work if i reboot my computer, but it would be great to have the proper way to do that (didn't found a clear soft to kill in task manager x')).
Anyway thanks for your tutorials, they are great.
Ps : it's not a cygwin bug, website is still accessible & functionnal on localhost
On my Mac when running this in the terminal I usually exit it with "Ctrl + C" command. I am not familiar of how this would work in Windows. It looks like they are discussing it in this Stackoverflow question https://superuser.com/questions/186670/is-there-ctrl-c-command-in-cygwin
I have the same problem on Windows, but you don't need to reboot. You can open the Task Manager (WINDOWS_KEY+X > Task Manager) and you'll see the "Node.js:Server-side JavaScript" row. Click on it and then click the End Task button in the bottom-right corner of the TM window. Then you can return the Cygwin command line and start it fine. I don't know of a way to stop it from the command line, though.
I have a similar problem, i was running react on port 3000, my terminal cleared everything before i got to stop the server now cannot start the server because i have something running on port 3000 it says i'm on a mac
@Guyana345
Find:
lsof -i :3000
Kill:
kill -9 <PID>
This is an issue with react-router, so I believe this issue should be close.
On a mac, Ctrl-C doesn't actually stops webpack, not for me at least ( @Andersos ), as this command would reveal:
ps aux | grep webpack
You can kill it with:
kill $(ps aux | grep 'webpack' | awk '{print $2}')
If you're on windows using 'windows git' terminal this will do the trick. taskkill //PID $(netstat -ano | grep 8080 | awk '{print $5}') //F >/dev/null 2>&1
Windows TLDR: 1: netstat -a -o -n (to get the PID) 2: taskkill /F /PID 12345 (Replace 12345 with your PID)
On windows machine I have same issue. Ctrl C seems to stop the server in command line, but then it is still running on Port 3000, etc.
If you go into command line and type netstat -a -o -n
This will show you all of the ports and process ids running.
The one you want is probably near the top of the list, and look under Local Address Column for row that matches your PORT: 0.0.0.0:3000 for port 3000 etc. Then on same row get the Process ID. This is the "PID" and then run this with your PID:
for example if PID is 15437 then
taskkill /F /PID 15437
Your PID will be unique and you need the first command to locate.
Linux: killall -KILL node
@youpiwaza if your issue is solved you can close this issue.
i had the same issue on windows solved it using the commands below remember these commands will only work in cmd not in gitbash this command will give you the process id of the process running on that specific port
$ netstat -ano | find ":3000 "
this command will tell you which program is using this port
$ tasklist /fi "pid eq {process-id}"
and this will kill that process
$ taskkill /pid {process-id} /f
or you can simply run task manager and kill node's process
with one app running: kill $(lsof -i :4000 | grep node | awk '{print $2}')
kill $(lsof -t -i:3000,3001)
// 3000 and 3001 are ports to be freed
For me this command does not work on Windows 10 in Cygwin:
$ kill -9 15916
bash: kill: (15916) - No such process
Instead of it you can use next commands:
$ netstat -ano | grep ':8080' | awk '{print $5}' | xargs powershell kill -f
$ netstat -ano | grep ':8080' | awk '{print $5}' | while read pid; do powershell kill -f $pid; done;
$ netstat -ano | grep ':8080' | awk '{sub(/\r/,"",$5) ; print $5}' | while read pid; do taskkill /F /PID $pid; done;
SUCCESS: The process with PID 15916 has been terminated.