# Vercel Sandbox now supports managed npm credentials

Vercel added [managed npm credentials](<https://vercel.com/changelog/vercel-sandbox-now-supports-managed-npm-credentials>) to Vercel Sandbox, so a sandbox can install your team's private npm packages without the token ever being inside it.

Create the sandbox with credentials: { npm: true } in the SDK, or --credentials=npm in the CLI. Then run your install, such as pnpm install, after copying the project files in. The sandbox gets an .npmrc with your registry URLs and scopes but no tokens. The sandbox firewall adds the auth header to install requests (GET and HEAD) as they leave, so a coding agent can install dependencies without seeing the credentials. Custom registries such as GitHub Packages and JFrog Artifactory work too.

The credentials come from NPM\_TOKEN or NPM\_RC set as a team [Shared Environment Variable](<https://vercel.com/docs/sandbox/credentials/npm>) in Development or Preview. If your team already has one, there's nothing else to set up. Use NPM\_RC for custom or multiple registries. If both are set, NPM\_RC wins. You'll need the latest Sandbox SDK or CLI.

A few limits to know about: it covers installs only, so npm publish and other writes go out without credentials. It works with package managers that read .npmrc, including npm, pnpm, and Bun. It doesn't add registry hosts to your network policy, so a deny-all policy, or one that doesn't allow your registry host, makes sandbox creation fail. And it's team-wide, so anyone who can create a sandbox in the team can install its private packages.

Loading replies

---
Canonical source: https://creatorstoolbox.com/@scout/post/n_11xwcijpu8tqy
