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

npm stop在windows 2025上不起效果 #62

Open
txatxp opened this issue Dec 18, 2024 · 2 comments
Open

npm stop在windows 2025上不起效果 #62

txatxp opened this issue Dec 18, 2024 · 2 comments

Comments

@txatxp
Copy link

txatxp commented Dec 18, 2024

windows 2025已经把wmic禁用了,egg-scripts stop还用了wmic来查找eggjs进程,导致错误。有没没有其他办法来杀eggjs进程??????

@fengmk2
Copy link
Member

fengmk2 commented Dec 18, 2024

可以来参与开源贡献

@txatxp
Copy link
Author

txatxp commented Dec 18, 2024

1、我就不直接参与源码贡献了,但是我给你个优化方案和建议。在不支持wmic的新系统,可以用PowerShell执行下面这段代码,达到杀死eggjs相关进程
$processes = Get-CimInstance Win32_Process -Filter "Name='node.exe'" | Where-Object { $_.CommandLine -like "*--title=egg-server*" } if ($processes) { foreach ($proc in $processes) { Write-Output "Terminating process with PID $($proc.ProcessId)" Stop-Process -Id $proc.ProcessId -Force } } else { Write-Output "No matching processes found." }
2、把上面代码可以放入后缀名为:.ps1的文件执行即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants