[{"data":1,"prerenderedAt":214},["ShallowReactive",2],{"content-/node-process-termination-rules":3,"all-pages-for-dir":191,"related-/node-process-termination-rules":192,"og-image-/node-process-termination-rules":213},{"id":4,"title":5,"body":6,"category":175,"concepts":175,"description":176,"extension":177,"meta":178,"navigation":179,"ogImage":175,"path":180,"project_name":175,"published":181,"publishedAt":182,"seo":183,"source":175,"stem":184,"tags":185,"todo":175,"unpublished":181,"updatedAt":182,"__hash__":190},"pages/2025-12/2025-12-19/node-process-termination-rules.md","Node.jsプロセス終了時の注意事項",{"type":7,"value":8,"toc":164},"minimark",[9,13,17,21,24,41,45,63,66,73,76,98,101,120,123,145,160],[10,11,5],"h1",{"id":12},"nodejsプロセス終了時の注意事項",[14,15,16],"h2",{"id":16},"問題の概要",[18,19,20],"p",{},"開発サーバーでエラーが発生した際、以下のコマンドでサーバーを再起動しようとすると、Claude Code自体も終了してしまう問題が発生しました。",[14,22,23],{"id":23},"問題のあるコマンド",[25,26,31],"pre",{"className":27,"code":28,"language":29,"meta":30,"style":30},"language-powershell shiki shiki-themes vitesse-light vitesse-light","Stop-Process -Name node -Force -ErrorAction SilentlyContinue\n","powershell","",[32,33,34],"code",{"__ignoreMap":30},[35,36,39],"span",{"class":37,"line":38},"line",1,[35,40,28],{},[42,43,44],"h3",{"id":44},"なぜ問題なのか",[46,47,48,57,60],"ul",{},[49,50,51,52,56],"li",{},"このコマンドは「node」という名前の",[53,54,55],"strong",{},"すべてのプロセス","を終了させる",[49,58,59],{},"Claude Code自体もNode.jsで動作しているため、一緒に終了する",[49,61,62],{},"結果として作業が中断され、再度Claude Codeを起動する必要がある",[14,64,65],{"id":65},"正しい対処方法",[18,67,68,69,72],{},"開発サーバー（例: localhost:3000）を再起動したい場合は、",[53,70,71],{},"ポート番号を指定して","該当プロセスのみを終了させること。",[42,74,75],{"id":75},"推奨コマンド",[25,77,79],{"className":27,"code":78,"language":29,"meta":30,"style":30},"# ポート3000を使用しているプロセスのみを終了\n$pid = (Get-NetTCPConnection -LocalPort 3000 -ErrorAction SilentlyContinue).OwningProcess | Select-Object -Unique\nif ($pid) { Stop-Process -Id $pid -Force }\n",[32,80,81,86,92],{"__ignoreMap":30},[35,82,83],{"class":37,"line":38},[35,84,85],{},"# ポート3000を使用しているプロセスのみを終了\n",[35,87,89],{"class":37,"line":88},2,[35,90,91],{},"$pid = (Get-NetTCPConnection -LocalPort 3000 -ErrorAction SilentlyContinue).OwningProcess | Select-Object -Unique\n",[35,93,95],{"class":37,"line":94},3,[35,96,97],{},"if ($pid) { Stop-Process -Id $pid -Force }\n",[42,99,100],{"id":100},"ポート番号が異なる場合",[25,102,104],{"className":27,"code":103,"language":29,"meta":30,"style":30},"# 例: ポート5173（Vite）の場合\n$pid = (Get-NetTCPConnection -LocalPort 5173 -ErrorAction SilentlyContinue).OwningProcess | Select-Object -Unique\nif ($pid) { Stop-Process -Id $pid -Force }\n",[32,105,106,111,116],{"__ignoreMap":30},[35,107,108],{"class":37,"line":38},[35,109,110],{},"# 例: ポート5173（Vite）の場合\n",[35,112,113],{"class":37,"line":88},[35,114,115],{},"$pid = (Get-NetTCPConnection -LocalPort 5173 -ErrorAction SilentlyContinue).OwningProcess | Select-Object -Unique\n",[35,117,118],{"class":37,"line":94},[35,119,97],{},[14,121,122],{"id":122},"ルール",[124,125,126,135,142],"ol",{},[49,127,128],{},[53,129,130,131,134],{},"絶対に ",[32,132,133],{},"Stop-Process -Name node"," を使用しないこと",[49,136,137,138,141],{},"開発サーバーの再起動は必ず",[53,139,140],{},"ポート指定","で行うこと",[49,143,144],{},"どのポートで動いているか不明な場合は、先に確認してから終了すること",[25,146,148],{"className":27,"code":147,"language":29,"meta":30,"style":30},"# 現在使用中のポートとプロセスを確認\nGet-NetTCPConnection -State Listen | Where-Object { $_.LocalPort -lt 10000 } | Select-Object LocalPort, OwningProcess\n",[32,149,150,155],{"__ignoreMap":30},[35,151,152],{"class":37,"line":38},[35,153,154],{},"# 現在使用中のポートとプロセスを確認\n",[35,156,157],{"class":37,"line":88},[35,158,159],{},"Get-NetTCPConnection -State Listen | Where-Object { $_.LocalPort -lt 10000 } | Select-Object LocalPort, OwningProcess\n",[161,162,163],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":30,"searchDepth":88,"depth":88,"links":165},[166,167,170,174],{"id":16,"depth":88,"text":16},{"id":23,"depth":88,"text":23,"children":168},[169],{"id":44,"depth":94,"text":44},{"id":65,"depth":88,"text":65,"children":171},[172,173],{"id":75,"depth":94,"text":75},{"id":100,"depth":94,"text":100},{"id":122,"depth":88,"text":122},null,"開発サーバー再起動時にClaude Codeを終了させないためのルール","md",{},true,"/node-process-termination-rules",false,"2025-12-19T00:00:00.000Z",{"title":5,"description":176},"2025-12/2025-12-19/node-process-termination-rules",[186,187,188,189],"Windows","Node.js","Claude Code","開発環境","D1_KeLmjGw4ZJOhvwYB1TYuTXAbSDHsx3g16-VAdiLc",[],[193,197,201,205,209],{"title":194,"path":195,"publishedAt":196},"Volta から mise への移行完了 - Claude Code を入れ直すまでに詰まった5つの落とし穴","/volta-to-mise-migration-complete","2026-04-23T00:00:00.000Z",{"title":198,"path":199,"publishedAt":200},"Volta から mise へ移行する方法（2026年版・メンテナンス終了対応）","/volta-to-mise-migration-guide","2026-06-09T00:00:00.000Z",{"title":202,"path":203,"publishedAt":204},"Windows Git Bashのタイムゾーン罠とVOICEVOX自動起動修正 - 開発環境改善ログ","/dev-env-improvements-2026-03-22","2026-03-22T00:00:00.000Z",{"title":206,"path":207,"publishedAt":208},"開発環境の快適性を高めるAutoHotkeyスクリプトとClaude Codeプラグイン改善","/dev-environment-improvements","2026-03-19T00:00:00.000Z",{"title":210,"path":211,"publishedAt":212},"Voltaがメンテナンス終了 - miseへの移行をどう進めるか","/volta-to-mise-migration","2026-03-09T00:00:00.000Z","https://log.eurekapu.com/og/blog/node-process-termination-rules.png?v=2025-12-19T00%3A00%3A00.000Z&title=Node.js%E3%83%97%E3%83%AD%E3%82%BB%E3%82%B9%E7%B5%82%E4%BA%86%E6%99%82%E3%81%AE%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A0%85&author=Kei%20Komatsu&sig=479a9019583770ef",1785654683219]