Cursor Agent's sandbox blocked npm install. Open the network the right way
A sandboxed terminal command fails with a network or permission error (npm/pip install, private registry, or outbound API), and retries keep hitting the same wall. Short answer: 5 steps. 1) Confirm it failed inside the sandbox; 2) Approve the out-of-sandbox rerun once; 3) Add the missing host in sandbox.json; 4) Pick the right network mode in settings; 5) Keep Run Everything off your daily machine.
Last updated: · This page is the decision checklist; the tools list for “Open Cursor sandbox network access” is a separate URL.
How do I fix this: Cursor Agent's sandbox blocked npm install?
Confirm it failed inside the sandbox
In Auto-review, Cursor sandboxes shell commands when it can. Network is blocked by default, then opened by your network mode and sandbox.json. If the failure mentions permission, network, or ECONNREFUSED only for Agent (while the same command works in your own terminal), treat it as a sandbox limit. Docs: https://cursor.com/docs/agent/security/run-modes
Approve the out-of-sandbox rerun once
When a sandboxed command fails on a sandbox restriction, the agent can ask to rerun it outside the sandbox; Auto-review's classifier reviews that rerun. Approve that prompt for a one-off install or fetch. Do not switch to Run Everything just to get past a single npm install.
Add the missing host in sandbox.json
Put networkPolicy.allow entries in ~/.cursor/sandbox.json (all projects) or .cursor/sandbox.json (this repo). Patterns can be exact hosts (registry.npmjs.org), wildcards (*.example.com), or CIDR. Deny always beats allow. Project file wins over the user file when both exist. Reference: https://cursor.com/docs/reference/sandbox
Pick the right network mode in settings
Under Settings > Agents > Approvals & Execution, sandbox.json + Defaults (the default) unions your allowlist with Cursor's package-manager defaults (npm, PyPI, crates.io, and similar). sandbox.json Only uses only your list. Allow All opens every host inside the sandbox. Prefer Defaults plus a short allowlist over Allow All on a machine with secrets.
Keep Run Everything off your daily machine
Run Everything skips the sandbox and the classifier for every tool call. Use it only when you accept that risk. For repeat trusted commands, put them on the allowlist or in permissions.json instead of disabling protections.
Which tools are best to open Cursor sandbox network access?
Cursor Run Modes
How Auto-review sandboxes shell commands, when a failed sandbox command can rerun outside, and network modes (sandbox.json + Defaults, Allow All).
sandbox.json reference
networkPolicy allow/deny patterns, file locations (~/.cursor vs project), and merge rules.
Cursor Terminal
How Agent runs shell commands and where sandboxing fits.
Cursor
Desktop Agent settings live under Settings > Agents > Approvals & Execution.
Open: 1 spot per week
One labeled sponsor for this topic each week; this week's spot is open. See open weeks →
All tools for “Open Cursor sandbox network access” →
Related fixes
- Stop a Cursor agent loopHow to fix a Cursor agent loop (same edit, or work after Stop)Fix →
- Claude Code vs Codex vs Cursor ~$20 plansClaude Code vs Codex vs Cursor $20 plan limits: how to pick without burning the weekFix →
- Scan a vibe-coded app for leaked API keysCheck a vibe-coded app for leaked API keys before you share itFix →
- Add an MCP server to Claude Code, Cursor, or CodexHow to add an MCP server to Claude Code, Cursor, or CodexFix →
See also AI tools launched today on the daily board.
NewAIToolsToday Daily
Top 3 AI launches, one model or news item that matters, and one simple fix. A 5-minute read, every weekday.