Submit a toolSubmit

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.

The problem: 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.

How do I fix this: Cursor Agent's sandbox blocked npm install?

  1. 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

  2. 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.

  3. 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

  4. 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.

  5. 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.

All tools for “Open Cursor sandbox network access” →

Related fixes

See also AI tools launched today on the daily board.