Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't stop the Vite server when restarting or quitting app using Ctrl-R/Ctrl-C #41

Open
henriksen opened this issue Aug 3, 2023 · 2 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@henriksen
Copy link

Overview

Upgraded to Vite 1.9 and removed the old KillPort setting, and the Vite server is no longer stopped when restarting or stopping app using the command line and Ctrl-R or Ctrl-C. Works as expected if restart or stop my app though Visual Studio.

Vite processes

When I start my application using and access it (running the middleware), a cmd window pops up for the Vite server. Two additional processes are started:

node   "C:\dev\app\node_modules\.bin\\..\vite\bin\vite.js"
"C:\Program Files\nodejs\\node.exe"  "C:\Users\Glenn\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" run dev

Using dotnet watch run / dotnet run

If I restart (using dotnet watch and Ctrl-R) or stop my app using Ctrl-C, the cmd window closes, but only the npm-cli.js run dev process exits. The node vite.js process is left running.

Starting and accessing my app again will try to start Vite but it will fail since the old Vite process is still running and it cannot open on the same port as before (I have locked the port in settings). The cmd Window opens and closes almost immediately.

Using Visual Studio

If I run my application from Visual Studio I get different behaviour, depending on how I restart/quit my app.

Both processes exit as they should if I...

  • Use the HotReload toolbar button -> Restart application
  • Using the Visual Studio stop button
  • Just closing the cmd popup console window using the window close button (X) or Alt-F4
  • Using the restart toolbar button or Ctrl-Shift F5
  • Close the ViteServer cmd window manually

One exception:
Stopping my app using Ctrl-C in the popup console window, I get the same behaviour as above, with the node vite.js process lingering.

Additional info

ViteServerLaunchManager is registered in Services along with the other ViteServer services.
image

dotnet --version
6.0.412

node -v
v19.9.0

systeminfo
OS Name:                   Microsoft Windows 11 Pro
OS Version:                10.0.22631 N/A Build 22631
@Eptagone Eptagone self-assigned this Aug 5, 2023
@Eptagone Eptagone added the help wanted Extra attention is needed label Aug 13, 2023
@Eptagone
Copy link
Owner

A little late but I'll add some validations to check if the vite server is already running before start a new process
b48cc02

@Eptagone
Copy link
Owner

Hi, are you still having this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants