question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Awais-cbcommented, 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

2reactions
LinusBorgcommented, Nov 1, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node JS ctrl + C doesn't stop server (after starting server with ...
It seems to be a specific problem running express via npm on Windows. If you run the server directly via the c:>node server.js...
Read more >
Node JS Tutorial: The Basics
Start a web browser (Chrome, Firefox). Issue URL http://localhost:3000/ . You shall see a hello-world message. To stop the server, press Ctrl-C ......
Read more >
`npm run dev` is a long-running program - Flavio Copes
When working on a website locally, you use the command npm run dev to start the development server. This is a common practice...
Read more >
The definitive Node.js handbook – Learn Node for Beginners
Node.js is a runtime environment for JavaScript that runs on the server. Node.js is open source, cross-platform, and since its introduction in ...
Read more >
Let It Crash: Best Practices for Handling Node.js Errors on ...
Some strategies to gracefully shutdown the Node.js process and quickly restart your application after a catastrophic error terminates your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found