Community코딩 & 개발github.com

Node Inspect 디버거

node inspect, --inspect, 중단점, CDP, 힙 및 CPU 프로필을 사용하여 Node.js를 디버깅합니다.

Node Inspect 디버거란 무엇인가요?

이 스킬은 숨겨진 지역 변수, 비동기 중단, 불안정한 테스트, 자식 프로세스, 시작 레이스, 메모리 증가, CPU 핫 경로 등 Node.js 디버깅에 필요한 고급 기능을 제공합니다. 기본적으로 `node inspect`를 사용하며, 스크립트 중단점, 자동 상태 캡처, 힙 스냅샷, CPU 프로필이 필요할 때만 Chrome DevTools Protocol을 사용합니다. TypeScript, 기존 PID 연결, 자식 프로세스 전파 등 다양한 시나리오를 지원하며, Vitest와 같은 도구와의 통합도 고려되어 있습니다. 또한 Chrome DevTools Protocol을 통한 프로그래밍 방식의 디버깅과 CPU/힙 프로파일링을 위한 명령어를 제공하여 복잡한 디버깅 작업을 자동화할 수 있습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/node-inspect-debugger

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Node Inspect 디버거은(는) 무엇을 하나요?

검사기 접근이 필요한 Node.js 디버깅에 사용합니다: 숨겨진 지역 변수, 비동기 중단, 불안정한 테스트, 자식 프로세스, 시작 레이스, 메모리 증가, CPU 핫 경로.

기본적으로 node inspect를 먼저 사용하세요. 스크립트 중단점, 자동 상태 캡처, 힙 스냅샷, 또는 CPU 프로필이 필요할 때만 Chrome DevTools Protocol을 사용하세요.

빠른 시작

  • 진입 시 일시 중지: node inspect path/to/script.js
  • TypeScript: node --inspect-brk --import tsx path/to/script.ts
  • 기존 PID: kill -SIGUSR1 <pid> 후 node inspect -p <pid>
  • 검사 대상 목록: curl -s http://127.0.0.1:9229/json/list | jq
  • OpenClaw CLI 경로: node --inspect-brk openclaw.mjs ...
  • OpenClaw 테스트 경로: OPENCLAW_VITEST_MAX_WORKERS=1 node --inspect-brk scripts/run-vitest.mjs <file>

디버거 REPL

  • 계속/단계 실행: cont, next, step, out, pause
  • 중단점: sb('file.js', 42), sb(42), sb('functionName'), breakpoints, cb('file.js', 42)
  • 검사: bt, list(8), watch('expr'), exec expr
  • 현재 스코프: repl 후 지역 변수를 직접 평가; Ctrl+C로 repl 모드 종료.
  • 안전하게 종료: 프로세스를 계속 실행해야 한다면 종료 전에 cont를 사용; 그렇지 않으면 kill.

OpenClaw 팁

  • 127.0.0.1 검사기 바인딩을 선호합니다. 네트워크가 격리되지 않은 이상 --inspect=0.0.0.0을 노출하지 마십시오.
  • Vitest의 경우, 하나의 파일을 하나의 워커로 디버그하세요. 단계 실행 중에는 워커 풀을 피하십시오.
  • TS 소스 중단점의 경우, 필요할 때 --enable-source-maps를 사용하세요; node inspect는 여전히 방출된 경로를 표시할 수 있습니다.
  • 자식 프로세스의 경우, NODE_OPTIONS=--inspect-brk가 검사기를 전파할 수 있지만, 각 자식 프로세스는 고유한 포트가 필요합니다.
  • 오래 지속되는 게이트웨이 또는 개발 프로세스의 경우, /json/list로 대상을 확인한 후 PID로 연결하세요.

프로그램 방식 CDP

프로젝트가 이미 의존하지 않는 한, 저장소 외부에 도구를 설치하십시오:

mkdir -p /tmp/cdp-tools
npm --prefix /tmp/cdp-tools i chrome-remote-interface
NODE_PATH=/tmp/cdp-tools/node_modules node /tmp/cdp-debug.cjs

최소 드라이버:

const CDP = require("chrome-remote-interface");

(async () => {
  const client = await CDP({ port: 9229 });
  const { Debugger, Runtime } = client;

  Debugger.paused(async ({ callFrames, reason }) => {
    const top = callFrames[0];
    console.log("paused", reason, top.url, top.location.lineNumber + 1);
    const { result } = await Debugger.evaluateOnCallFrame({
      callFrameId: top.callFrameId,
      expression: "JSON.stringify({ pid: process.pid })",
    });
    console.log(result.value ?? result.description);
    await Debugger.resume();
  });

  await Runtime.enable();
  await Debugger.enable();
  await Debugger.setBreakpointByUrl({ urlRegex: ".*target\\.js$", lineNumber: 41 });
  await Runtime.runIfWaitingForDebugger();
})();

프로필

  • CPU: Profiler 활성화, start, 대기, stop, /tmp/profile.cpuprofile에 쓰기, Chrome DevTools에서 열기.
  • 힙: HeapProfiler 활성화, addHeapSnapshotChunk 수집, takeHeapSnapshot 호출, /tmp/heap.heapsnapshot에 쓰기.

함정

  • --inspect는 일시 중지하지 않습니다; 코드 실행 전에 설정이 필요한 경우 --inspect-brk를 사용하십시오.
  • 기본 포트는 9229입니다; 병렬 대상에는 --inspect=0 또는 고유한 포트를 사용하십시오.
  • 중단점이 누락된 경우, 파일 경로, 소스 맵 동작, 그리고 실행이 이미 해당 줄을 통과했는지 확인하십시오.
  • 분리 후 프로세스가 멈춘 것처럼 보이면, 여전히 디버거에서 일시 중지된 상태일 수 있습니다.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills when explicitly requested; install, verify, update, uninstall, publish, or sync skills.

관련 스킬