[BUG] Windows flashes terminal window running "npm list" periodically
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using claude from the terminal on Windows I'm periodically seeing a flash from a windows terminal window. I can see that it's cmd.exe and I can see it's running npm list. This is indicitive of spawning a process without specifying to hide the window. Common windows bug/issue. It's very annoying.
I then had claude write a small powershell script to watch for this and it identified...claude as the suspect. So I'm reporting it here. :-)
What Should Happen?
Claude should modify when it calls "npm list" or other similar commands in windows to hide the command window.
Error Messages/Logs
Steps to Reproduce
Here's the powershell script claude wrote that identifies itself. Then run queries against claude until this happens.
Watches for ALL new cmd.exe, powershell.exe, pwsh.exe, node.exe,
conhost.exe, and wt.exe processes. Catches short-lived flashing windows.
Press Ctrl+C to stop
Write-Host "Watching for all console/shell process creation... (Ctrl+C to stop)" -ForegroundColor Cyan
$query = @"
SELECT * FROM __InstanceCreationEvent WITHIN 0.5
WHERE TargetInstance ISA 'Win32_Process'
AND (
TargetInstance.Name = 'cmd.exe'
OR TargetInstance.Name = 'powershell.exe'
OR TargetInstance.Name = 'pwsh.exe'
OR TargetInstance.Name = 'node.exe'
OR TargetInstance.Name = 'npm.cmd'
OR TargetInstance.Name = 'conhost.exe'
)
"@
Register-WmiEvent -Query $query -SourceIdentifier "FlashWatcher" -Action {
$proc = $Event.SourceEventArgs.NewEvent.TargetInstance
$parentId = $proc.ParentProcessId
$parentProc = Get-CimInstance Win32_Process -Filter "ProcessId = $parentId" -ErrorAction SilentlyContinue
Write-Host "`n=== CAUGHT at $(Get-Date -Format 'HH:mm:ss') ===" -ForegroundColor Yellow
Write-Host "Process: $($proc.Name) (PID $($proc.ProcessId))" -ForegroundColor Green
Write-Host "CommandLine: $($proc.CommandLine)" -ForegroundColor White
Write-Host "Parent: $($parentProc.Name) (PID $parentId)" -ForegroundColor Magenta
Write-Host "Parent Cmd: $($parentProc.CommandLine)" -ForegroundColor Magenta
} | Out-Null
try {
while ($true) { Start-Sleep -Seconds 1 }
} finally {
Unregister-Event -SourceIdentifier "FlashWatcher"
Write-Host "`nStopped watching." -ForegroundColor Cyan
}
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.89 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
This is about it. Flashing terminal windows calling "npm list" when using claude code on Windows. Hide the window is all you have to do.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗