Webpack: Dev server continues to run after aborting `npm run dev` (Ctrl+C)

Created on 16 Jul 2017  路  11Comments  路  Source: vuejs-templates/webpack

Description

I had to restart the dev server after pulling in a package. In my terminal, where npm run dev command was being executed, I pressed Ctrl+C to abort it. Then I ran npm run dev again and it failed with some reference to localhost:8080, and from what I understood, the port was already occupied. Indeed, when I went to localhost:8080 the app was still running even though npm run dev was terminated and the terminal was closed.

Steps

  1. npm run dev
  2. Ctrl+C
  3. npm run dev

Results

  • Expected: it should restart the dev server
  • Actual: it fails with an error; the server isn't halted and continues to run on localhost:8000

Brute-force fix

Kill the process manually. In WIndows, you can kill Node.js: Server-side JavaScript from Task Manager.

Most helpful comment

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

All 11 comments

Could you give some information about your environment?

  1. What OS are you using?
  2. What terminal are you running the command in?
  3. Which version of Node.js?
  4. Do you have the same issue with a fresh copy of the template?
  5. Are you using a command other than npm run dev?

I have the same thing.

npm run dev
press Ctrl-C
reload page and its still running

In order to really stop it I have to run taskkill /F /IM node.exe

Windows 10
Git bash
node 8.1.4
webpack 2.3.3
webpack-dev-middleware 1.11.0

Edited: meant webpack 2.3.x

@MaxMilton Same setup as @Christilut except I got node 6.11.1 and webpack 2.6.1. Everything else is up to date and the project is brand-new. No other commands are involved. I noticed that this issue doesn't occur with webpack-simple template.

I have the same issue.

Windows 10
Git bash / cmd
node 8.1.4
webpack 2.6.1
webpack-dev-middleware 1.10.0
webpack-hot-middleware 2.18.0

Only "npm run dev" is used.

same issue

  • os: windows 10
  • terminal: git bash git version 2.14.1.windows.1
    but It's OK in power shell
  • node: 8.3.0
  • npm: 5.3.0
    "webpack": "^2.6.1",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-middleware": "^1.10.0",
    "webpack-hot-middleware": "^2.18.0",

This is very possibly this issue from git for windows: https://github.com/git-for-windows/git/issues/1248

Doesn't seem to be directly related to this template. Plus we will be switching to webpack-dev-server in the coming days (#975), so this would have to be re-evaluated after that.

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

I have the same thing.

npm run dev
press Ctrl-C
reload page and its still running

In order to really stop it I have to run taskkill /F /IM node.exe

Windows 10
Git bash
node 8.1.4
webpack 2.3.3
webpack-dev-middleware 1.11.0

Edited: meant webpack 2.3.x

Worked for me.. thanks @Christilut

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

Thank you! It works in both Ubuntu and Windows CMD

Was this page helpful?
0 / 5 - 0 ratings