The Cursor AI agent terminal on Windows cannot spawn child processes (e.g. esbuild, node.exe) when running commands like npm run test, resulting in spawn EPERM errors. The same commands work perfectly in a normal terminal.
The issue seems to be Cursor’s agent terminal sandbox on Windows blocking child processes spawning.
Steps to Reproduce
Ask agent to run terminal command from a Windows machine. See error output in terminal.
Expected Behavior
Agent is able to run terminal commands on Windows machines.
I use Surfshark AntiVirus but have added all node_modules as exclusions, so this shouldn’t be blocking it. I also installed Powershell 7 and set it as the default, but that didn’t resolve the issue.
The full error is:
⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯
Error: spawn EPERM
at ChildProcess.spawn (node:internal/child_process:420:11)
at Object.spawn (node:child_process:753:9)
at ensureServiceIsRunning ([FILE PATH]\node_modules\esbuild\lib\main.js:1978:29)
at build ([FILE PATH]\node_modules\esbuild\lib\main.js:1876:26)
at bundleConfigFile (file:///[FILE PATH]/node_modules/vite/dist/node/chunks/dep-D4NMHUTW.js:49309:24)
at async bundleAndLoadConfigFile (file:///[FILE PATH]/node_modules/vite/dist/node/chunks/dep-D4NMHUTW.js:49293:19)
at async loadConfigFromFile (file:///[FILE PATH]/node_modules/vite/dist/node/chunks/dep-D4NMHUTW.js:49257:44)
at async resolveConfig (file:///[FILE PATH]/node_modules/vite/dist/node/chunks/dep-D4NMHUTW.js:48752:24)
at async _createServer (file:///[FILE PATH]/node_modules/vite/dist/node/chunks/dep-D4NMHUTW.js:38349:66)
at async createViteServer (file:///[FILE PATH]/node_modules/vitest/dist/chunks/cli-api.BkDphVBG.js:6911:17) {
errno: -4048,
code: ‘EPERM’,
syscall: ‘spawn’
}
Get-ChildItem : An item with the same key has already been added.
At [FILE PATH]\AppData\Local\Temp\ps-script-fded9fe0-2501-42bd-868b-84af575fba92.ps1:31 char:16
$envVars = Get-ChildItem Env: | Sort-Object Name
~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (
[Get-ChildItem], ArgumentException
FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.GetChildItemCommand
I have enabled Legacy Terminal Tool and this seems to have resolved the issue, thanks.