npm process won't exit when the terminal window is closed #20239

Closed
opened 2026-01-31 07:07:48 +00:00 by claunia · 5 comments
Owner

Originally created by @jsoldi on GitHub (Jul 14, 2023).

Windows Terminal version

1.17.11461.0

Windows build number

10.0.22621.1992

Other Software

npm v9.6.7
node v18.15.0

Steps to reproduce

  1. Create a folder and clone my sample repro: npx degit https://github.com/jsoldi/windows-terminal-bug. It's just a plain server that does nothing.
  2. Do npm install
  3. Open the Windows Terminal on the project folder and run npm start 3000 and then visit localhost:3000 on a browser.
  4. Close the terminal.
  5. Reload localhost:3000 and the server should still be running

If the process actually stops, try repeating steps 3-5 one more time.

Expected Behavior

The process should stop.

Actual Behavior

The process doesn't stop, and I don't know of any way to stop it other than restarting the machine or relogging the user. I've also tried closing the wt from the task manager but that doesn't seem to help.

Notes

I've noticed that the process will actually stop either if I run the script directly with node index.js, or if I do npm start from CMD or PS, so somehow the combination of terminal and npm seems to cause the issue.

Originally created by @jsoldi on GitHub (Jul 14, 2023). ### Windows Terminal version 1.17.11461.0 ### Windows build number 10.0.22621.1992 ### Other Software npm v9.6.7 node v18.15.0 ### Steps to reproduce 1. Create a folder and clone my sample repro: `npx degit https://github.com/jsoldi/windows-terminal-bug`. It's just a plain server that does nothing. 2. Do `npm install` 3. Open the Windows Terminal on the project folder and run `npm start 3000` and then visit `localhost:3000` on a browser. 4. Close the terminal. 5. Reload `localhost:3000` and the server should still be running If the process actually stops, try repeating steps 3-5 one more time. ### Expected Behavior The process should stop. ### Actual Behavior The process doesn't stop, and I don't know of any way to stop it other than restarting the machine or relogging the user. I've also tried closing the wt from the task manager but that doesn't seem to help. ### Notes I've noticed that the process will actually stop either if I run the script directly with `node index.js`, or if I do `npm start` from CMD or PS, so somehow the combination of terminal and npm seems to cause the issue.
claunia added the Issue-BugResolution-DuplicateProduct-TerminalArea-Server labels 2026-01-31 07:07:49 +00:00
Author
Owner

@cs-NET commented on GitHub (Jul 14, 2023):

Experiencing the same issue, I ended up creating a script to kill all the node processes as a temp workaround as sometimes I have dozens of orphaned node.exe running, might not be the best workaround but beats manually trying to kill each process one at a time:

taskkill /f /im node.exe
@cs-NET commented on GitHub (Jul 14, 2023): Experiencing the same issue, I ended up creating a script to kill all the node processes as a temp workaround as sometimes I have dozens of orphaned node.exe running, might not be the best workaround but beats manually trying to kill each process one at a time: ``` taskkill /f /im node.exe ```
Author
Owner

@carlos-zamora commented on GitHub (Aug 2, 2023):

Thanks for filing! We're going to mark this as a /dup of #15373.

The repro steps are fantastic though, so I'll be sure to copy that over :)

@carlos-zamora commented on GitHub (Aug 2, 2023): Thanks for filing! We're going to mark this as a /dup of #15373. The repro steps are fantastic though, so I'll be sure to copy that over :)
Author
Owner

@carlos-zamora commented on GitHub (Aug 2, 2023):

/dup #15373

@carlos-zamora commented on GitHub (Aug 2, 2023): /dup #15373
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Aug 2, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Aug 2, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@microsoft-github-policy-service[bot] commented on GitHub (Aug 2, 2023):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service[bot] commented on GitHub (Aug 2, 2023): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20239