Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Lesson 10 / How to stop webpack server #240

Open
youpiwaza opened this issue Sep 23, 2016 · 14 comments
Open

Lesson 10 / How to stop webpack server #240

youpiwaza opened this issue Sep 23, 2016 · 14 comments

Comments

@youpiwaza
Copy link

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

@Andersos
Copy link

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

@drahmel
Copy link

drahmel commented Dec 20, 2016

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.

@tamakunay
Copy link

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

@Andersos
Copy link

@Guyana345
Find:
lsof -i :3000
Kill:
kill -9 <PID>

@Izhaki
Copy link

Izhaki commented Jul 21, 2017

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}')

@Mantisimo
Copy link

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

@NickFoden
Copy link

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.

@uxiv
Copy link

uxiv commented Oct 20, 2017

Linux:
killall -KILL node

@Andersos
Copy link

Andersos commented Feb 2, 2018

@youpiwaza if your issue is solved you can close this issue.

@Awais-cb
Copy link

Awais-cb commented Oct 27, 2018

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

@Awais-cb
Copy link

Awais-cb commented Oct 27, 2018

or you can simply run task manager and kill node's process

@defusioner
Copy link

with one app running: kill $(lsof -i :4000 | grep node | awk '{print $2}')

@abhijithqb
Copy link

kill $(lsof -t -i:3000,3001) // 3000 and 3001 are ports to be freed

@popovserhii
Copy link

popovserhii commented Apr 10, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests