I run webpack-dev-server from windows console with the command:
webpack-dev-server --content-base ./build --inline --hot
after this I see message webpack: bundle is now VALID.
and I can't type anything there. But if I change something in webpack.config.js I have to close console, open it again and start webpack-dev-server for apply my changes.
How can I stop webpack dev server without close console?
To stop this from running, in the command prompt, type CTRL-C. You will get the prompt to Terminate batch job: Type Y and the app will stop running: You can now run npm start again if you want to relaunch the app.
And if I want to use react-hot-loader, is the webpack-dev-server necessary? Nope, it works on top of Webpack's hot module replacement interface. You can create your own 'hot server' if you want.
This means that if you're trying to figure out where your compiled files are going, you won't see them in a directory. To see where they're going, go to localhost:8080/webpack-dev-server.
The Result Either method will start a server instance and begin listening for connections from localhost on port 8080 . webpack-dev-server is configured by default to support live-reload of files as you edit your assets while the server is running. See the documentation for more use cases and options.
You only need to type Ctrl+C two times
I run webpack devserver by issuing the "npm start" command. I've found that CTRL+C doesn't work for me and just creates an orphaned process. I'm able to kill the devserver by opening the task manager and killing any running node.exe processes.
Another way to do this from plain jane windows console is to find the node process Ids and kill them.
tasklist /FI "IMAGENAME eq node.exe"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
node.exe 4620 Console 2 44,568 K
node.exe 12452 Console 2 486,260 K
Then kill them with the following command.
taskkill /F /PID 4620 /PID 12452
An alternative more direct approach as pointed out by a comment.
taskkill /F /IM node.exe
I have also been running into this hard-to-kill webpack-dev-server process on my Windows machine lately.
Ctrl+C/break and even closing were getting me nowhere and I quickly tired of manually tracking down the process and killing it.
This one-liner did the trick for me:
for /f "tokens=5" %a in ('netstat -aon ^| findstr 8080 ^| findstr LISTENING') do taskkill /pid %a /f
I went ahead and made a kill-server.bat file for it:
@echo off
for /f "tokens=5" %%a in ('netstat -aon ^| findstr %1 ^| findstr LISTENING') do taskkill /pid %%a /f && echo killed PID %%a
I put that on my PATH, so now to kill a server using a specific port I can just:
kill-server 8080
On a side note, this issue seems to happen for me only when I use console emulation tools, not when I am using the windows command prompt directly.
On Windows this Powershell seems to kill it (and all Node processes!)
get-process node | Stop-Process
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With