Index of every page on this site: llms.txt
All skills
github avatar

/sandbox-npm-install

@f10fdb8 official
by githubgithub/awesome-copilot42k stars
5,426
Run it yourself

Install npm packages in a Docker sandbox environment. Use this skill whenever you need to install, reinstall, or update node_modules inside a container where the workspace is mounted via virtiofs. Native binaries (esbuild, lightningcss, rollup) crash on virtiofs, so packages must be installed on the local ext4 filesystem and symlinked back.

Use this Skill: https://skilld.dev/gh/github/awesome-copilot/sandbox-npm-install

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈91 tokens for metadata: the name and description. ≈855 when used: this file.

Description uses 4.5% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈364 characters, or 4.5%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Sandbox npm Install

When to Use This Skill

Use this skill whenever:

  • You need to install npm packages for the first time in a new sandbox session
  • package.json or package-lock.json has changed and you need to reinstall
  • You encounter native binary crashes with errors like SIGILL, SIGSEGV, mmap, or unaligned sysNoHugePageOS
  • The node_modules directory is missing or corrupted

Prerequisites

  • A Docker sandbox environment with a virtiofs-mounted workspace
  • Node.js and npm available in the container
  • A package.json file in the target workspace

Background

Docker sandbox workspaces are typically mounted via virtiofs (file sync between the host and Linux VM). Native Go and Rust binaries (esbuild, lightningcss, rollup, etc.) crash with mmap alignment failures when executed from virtiofs on aarch64. The fix is to install on the container's local ext4 filesystem and symlink back into the workspace.

Step-by-Step Installation

Run the bundled install script from the workspace root:

bash scripts/install.sh

Common Options

Option Description
--workspace <path> Path to directory containing package.json (auto-detected if omitted)
--playwright Also install Playwright Chromium browser for E2E testing

What the Script Does

  1. Copies package.json, package-lock.json, and .npmrc (if present) to a local ext4 directory
  2. Runs npm ci (or npm install if no lockfile) on the local filesystem
  3. Symlinks node_modules back into the workspace
  4. Verifies known native binaries (esbuild, rollup, lightningcss, vite) if present
  5. Optionally installs Playwright browsers and system dependencies (uses sudo when available)

If verification fails, run the script again — crashes can be intermittent during initial setup.

Post-Install Verification

After the script completes, verify your toolchain works. For example:

npm test             # Run project tests
npm run build        # Build the project
npm run dev          # Start dev server

Important Notes

  • The local install directory (e.g., /home/agent/project-deps) is container-local and is NOT synced back to the host
  • The node_modules symlink appears as a broken link on the host — this is harmless since node_modules is typically gitignored
  • Running npm ci or npm install on the host naturally replaces the symlink with a real directory
  • After any package.json or package-lock.json change, re-run the install script
  • Do NOT run npm ci or npm install directly in the mounted workspace — native binaries will crash

Troubleshooting

Problem Solution
SIGILL or SIGSEGV when running dev server Re-run the install script; ensure you're not running npm install directly in the workspace
node_modules not found after install Check that the symlink exists: ls -la node_modules
Permission errors during install Ensure the local deps directory is writable by the current user
Verification fails intermittently Run the script again — native binary crashes can be non-deterministic on first load

Vite Compatibility

If your project uses Vite, you may need to allow the symlinked path in server.fs.allow. Add the symlink target's parent directory (e.g., /home/agent/project-deps/) to your Vite config so that Vite can serve files through the symlink.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo5 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides a utility script to install Node.js dependencies within a Docker sandbox. It circumvents filesystem issues by installing packages to a local directory and symlinking them to the workspace. The script handles environment setup tasks like running npm install, verifying native binaries, and optionally installing Playwright browsers.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: MEDIUM · 1 issue

  • Runlayer8mo

    2/2 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at f10fdb8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 8 months ago
  • docker
  • npm
  • virtiofs
  • native-binaries
  • node-modules
  • sandbox
  • esbuild
  • installation

README badge

README badge for github/awesome-copilot/sandbox-npm-install

Installs npm packages on a Docker container's local ext4 filesystem and symlinks node_modules back into a virtiofs-mounted workspace, avoiding native binary crashes from tools like esbuild and rollup. Use this when installing dependencies in a sandbox where the workspace is mounted via virtiofs and native binaries fail with mmap alignment errors.

Generated from the current SKILL.md.

Why do native binaries crash in virtiofs-mounted workspaces?
Native binaries like esbuild, lightningcss, and rollup crash with mmap alignment failures when executed from virtiofs on aarch64. Installing on the container's local ext4 filesystem and symlinking back avoids these crashes.
Can I run npm install directly in my workspace?
No. Running npm ci or npm install directly in the virtiofs-mounted workspace will cause native binaries to crash. Always use the bundled install script instead.
Why does node_modules appear as a broken link on the host?
The skill symlinks node_modules from the container's local filesystem back into the workspace. On the host, this symlink appears broken because the target directory doesn't exist there, but this is harmless since node_modules is typically gitignored.
Do I need to re-run the install script after changing package.json?
Yes. After any package.json or package-lock.json change, re-run the install script to update the local ext4 copy and its symlink.
Does this skill support Vite projects?
Yes. For Vite projects, you may need to add the symlink target's parent directory to your Vite config's server.fs.allow setting so Vite can serve files through the symlink.

Generated from the current SKILL.md. These answers refresh after source changes.