본문으로 건너뛰기
cccskills
무료GitHub에 공개

node-inspect-debugger

Debug Node.js via --inspect + Chrome DevTools Protocol.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.5 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Node.js Inspect Debugger

Overview

When console.log isn't enough, drive Node's built-in V8 inspector programmatically from the terminal. Real breakpoints, step in/over/out, call-stack walking, scope dumps, and arbitrary expression evaluation.

Prefer node inspect first. It's always available and the REPL is fast.

When to Use

  • A Node test fails and you need to see intermediate state
  • A Node process crashes or behaves wrong and you want to inspect state
  • You need to inspect a value in a closure that console.log can't reach
  • Perf: attach to a running process to capture a CPU profile or heap snapshot

Don't use for: things console.log solves in under a minute.

Quick Reference: node inspect REPL

Launch paused on first line:

node inspect path/to/script.js
# or with tsx
node --inspect-brk $(which tsx) path/to/script.ts

The debug> prompt accepts:

CommandAction
ccontinue
nnext line (step over)
sstep into
ostep out
sb('file.js', line)set breakpoint
cb('file.js', line)clear breakpoint
watch('expr')watch expression
exec('expr')evaluate in paused frame
backtrace / btshow call stack
list(N)show N lines around current

Scriptable CDP via chrome-remote-interface

For automated debugging (many breakpoints, collect state across runs):

# Install
npm install chrome-remote-interface

# Launch node with inspect
node --inspect-brk=9229 path/to/script.js &

# Attach via script
node -e "
const CDP = require('chrome-remote-interface');
(async () => {
  const client = await CDP({port: 9229});
  const {Debugger, Runtime} = client;
  await Debugger.enable();
  await Runtime.enable();
  Debugger.paused(({callFrames}) => {
    console.log('Paused at:', callFrames[0].location);
    // Inspect scope, evaluate expressions, etc.
  });
  // Set breakpoint
  await Debugger.setBreakpointByUrl({lineNumber: 10, url: 'file:///path/to/script.js'});
  await Debugger.resume();
})();
"

Attaching to a Running Process

# Start with --inspect (no brk = doesn't pause on start)
node --inspect=9229 path/to/server.js

# Attach from another terminal
node inspect localhost:9229

CPU Profile

# Start with inspect
node --inspect path/to/script.js

# In another terminal, capture profile
node -e "
const CDP = require('chrome-remote-interface');
(async () => {
  const client = await CDP({port: 9229});
  const {Profiler} = client;
  await Profiler.enable();
  await Profiler.start();
  // Wait for workload...
  await new Promise(r => setTimeout(r, 10000));
  const {profile} = await Profiler.stop();
  require('fs').writeFileSync('profile.cpuprofile', JSON.stringify(profile));
})();
"

# Load profile.cpuprofile in Chrome DevTools > Performance

Pitfalls

  • --inspect vs --inspect-brk: --inspect doesn't pause; --inspect-brk pauses on first line. Use brk when you need to catch early code.
  • Port conflicts: default port 9229 may be taken. Use --inspect=9230.
  • ESM vs CJS: node inspect works with both, but ESM may show different call stack formatting.
  • Source maps: TypeScript/tsx may show transpiled line numbers. Use --enable-source-maps for accurate mapping.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Structured peer-review of academic papers.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HezaoHezao/poirot2512026년 7월 29일 업데이트

Dark-themed SVG architecture/cloud/infra diagrams as HTML.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HezaoHezao/poirot2512026년 7월 29일 업데이트

arxiv

무료

Search arXiv papers by keyword, author, category, or ID.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HezaoHezao/poirot2512026년 7월 29일 업데이트

Monitor blogs and RSS/Atom feeds via blogwatcher-cli.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HezaoHezao/poirot2512026년 7월 29일 업데이트

bootstrap

무료

Onboarding conversation to generate a user profile.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HezaoHezao/poirot2512026년 7월 29일 업데이트

Generate charts: select type, extract data, render image.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

HezaoHezao/poirot2512026년 7월 29일 업데이트

HezaoHezao의 스킬 모두 보기

이 스킬의 문제 신고