Cursor Agent Terminal: spawn EPERM on Windows

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

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.

Operating System

Windows 10/11

Version Information

Version: 2.4.22 (system setup)
VSCode Version: 1.105.1
Commit: 618c607a249dd7fd2ffc662c6531143833bebd40
Date: 2026-01-26T22:51:47.692Z
Build Type: Stable
Release Track: Default
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26200

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This looks like a Windows sandbox issue, there are a few similar reports.

Can you try this workaround: Legacy Terminal
Cursor Settings > Agents > Terminal > enable “Legacy Terminal Tool”

This will disable the sandbox, and the agent will use the regular terminal.

Also, for debugging it would help to know:

  1. The full error log from the terminal
  2. Are you using an antivirus or a corporate firewall?

I’ll pass this to the team.

Hi Dean,

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.

Tim