본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)40k · #7415

sandbox-npm-install

하는 일

이 도구는 격리된 환경(샌드박스) 안에 Node.js 패키지('npm 패키지')를 설치합니다. 특정 아키텍처(ARM)용으로 컴파일된 프로그램이 특정 방식(virtiofs)으로 파일에 접근할 때 제대로 작동하지 않는 흔한 문제를 해결합니다. 패키지를 안전한 위치에 설치하고 프로젝트와 '연결'해서 제대로 작동하게 합니다.

사용하는 경우

  • ✓새 Node.js 프로젝트를 시작해서 처음으로 의존성을 내려받아야 할 때.
  • ✓필요한 패키지 목록(package.json 파일)을 바꿔서 설치를 업데이트해야 할 때.
  • ✓프로젝트를 실행하거나 빌드할 때 이상한 오류가 나타나고, 특히 '네이티브 바이너리' 관련 문제일 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/sandbox-npm-install/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“샌드박스에 제 Node.js 프로젝트의 패키지를 설치해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 프로젝트의 설정 파일을 격리된 환경 안의 안전한 영역으로 복사합니다. 그곳에서 설치 명령(npm ci)을 실행합니다. 마지막으로 바로가기(심볼릭 링크)를 만들어 프로젝트가 설치된 패키지에 안전하게 접근하도록 합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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.

자주 묻는 질문

왜 그냥 `npm install`을 쓰면 안 되나요?

'virtiofs'라는 기술을 쓰는 일부 격리 환경(샌드박스)에서는 esbuild, lightningcss처럼 네이티브로 컴파일된 프로그램이 실패할 수 있습니다. 이 도구는 샌드박스 안의 다른 안전한 위치에 패키지를 설치해 문제를 피합니다.

설치된 패키지는 어떻게 되나요?

패키지는 컴퓨터의 주 저장 공간과 동기화되지 않는 샌드박스 안의 디렉터리에 설치됩니다. 프로젝트는 바로가기를 통해 패키지에 접근하지만, 실제 디렉터리는 격리된 상태로 남습니다.

도구를 실행한 뒤 해야 할 일이 있나요?

네, 설치 후에는 테스트(npm test), 빌드(npm run build), 개발 서버 실행(npm run dev)을 해 보며 프로젝트가 제대로 작동하는지 확인해야 합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
40k
순위
#7415
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬