Langsung ke konten
Skillpedia
Deploy & cloud (DevOps)40k Β· #7415

sandbox-npm-install

Fungsinya

Alat ini menginstal paket Node.js (disebut 'npm packages') di dalam lingkungan terisolasi (sandbox) di komputer Anda. Alat ini mengatasi masalah umum di mana program yang dikompilasi untuk berjalan di mesin tertentu (seperti arsitektur ARM) tidak berfungsi dengan benar saat file diakses dengan cara tertentu (virtiofs). Alat ini menginstal paket di lokasi yang aman lalu 'menautkannya' ke proyek Anda agar dapat digunakan.

Kapan dipakai

  • βœ“Saat Anda memulai proyek Node.js baru dan perlu mengunduh dependensi untuk pertama kali.
  • βœ“Jika Anda mengubah daftar paket yang dibutuhkan (file package.json) dan perlu memperbarui instalasi.
  • βœ“Jika Anda mengalami error aneh saat menjalankan atau membangun proyek, terutama yang berkaitan dengan 'native binaries'.

Link skill

https://github.com/github/awesome-copilot/blob/main/skills/sandbox-npm-install/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/github/awesome-copilot/blob/main/skills/sandbox-npm-install/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œInstal paket proyek Node.js saya di sandbox.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Alat ini menyalin file konfigurasi proyek Anda ke area aman di dalam lingkungan terisolasi. Di sana, alat ini menjalankan perintah instalasi (npm ci). Terakhir, alat ini membuat pintasan (symlink) agar proyek Anda dapat mengakses paket yang terinstal secara aman.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

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.

Pertanyaan umum

Mengapa saya tidak bisa langsung menggunakan `npm install` secara normal?

Di beberapa lingkungan terisolasi (sandbox) yang menggunakan teknologi bernama 'virtiofs', program hasil kompilasi native (seperti esbuild, lightningcss) bisa gagal. Alat ini melewati masalah tersebut dengan menginstal paket di lokasi lain yang aman di dalam sandbox.

Apa yang terjadi pada paket yang sudah terinstal?

Paket diinstal di dalam direktori sandbox yang tidak disinkronkan kembali ke komputer utama Anda. Proyek Anda mengakses paket ini melalui pintasan, tetapi direktori aslinya tetap terisolasi.

Apakah saya perlu melakukan sesuatu setelah menjalankan alat ini?

Ya, setelah instalasi, Anda sebaiknya memastikan proyek berjalan sebagaimana mestinya dengan mencoba menjalankan tes (npm test), build (npm run build), atau memulai server pengembangan (npm run dev).

Detail

Deskripsi asli dari pembuat

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.

repo: github/awesome-copilot

Popularitas

Bintang GitHub
40k
Peringkat
#7415
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa