[BUG] On Windows a plain `node server.js` script outlives npm
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript, node.js
調査の方向性
Start by tracing how @npmcli/run-script launches lifecycle scripts on Windows and how it distinguishes plain executable commands from shell syntax, .cmd bins, and builtins. Reproduce the issue with the PowerShell steps in the report, then find the relevant existing tests and add coverage for the command cases described. Done means a plain executable script stops with npm while the listed shell commands retain their current behavior.
索引モデルが issue の本文から書いたものです。
説明
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
On macOS npm start with "start": "node server.js" ends up as npm's direct child, because /bin/sh execs a lone command. Stop npm and the server stops too.
On Windows the script runs as cmd.exe /d /s /c node server.js. libuv's job object kills npm's children when npm dies, but it sets SILENT_BREAKAWAY_OK, so only cmd.exe is in the job. Stop npm with Stop-Process or taskkill without /T and node keeps running with the port open. Coding agents hit this all the time with dev servers.
Expected Behavior
The change runs a script that is a single .exe with plain arguments without cmd.exe, much like sh does. Scripts with cmd syntax (&&, pipes, redirects, quotes, %VAR%), .cmd bins and builtins are unchanged. One process less per script, and the server goes away with npm (25 of 25 runs). Start-up time doesn't change measurably. Tests included, coverage stays at 100%.
Steps To Reproduce
# package.json: "scripts": { "start": "node server.js" }
$p = Start-Process node -ArgumentList "$env:ProgramFiles\nodejs\node_modules\npm\bin\npm-cli.js", 'start' -PassThru
Stop-Process -Id $p.Id
Get-NetTCPConnection -LocalPort 8765 -State Listen # still there
Environment
- npm: 11.19.0, and @npmcli/run-script main (4d116d5) for the change
- Node.js: 26.7.0
- OS: Windows 11 x64, PowerShell 7.6
- npm config: defaults
- 主要言語
- JavaScript
- スター
- 60
- フォーク
- 29
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
npm/run-script のほかの issue
-
Needs Triage
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
npm/run-script#237 ·
-
Needs Triage
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
npm/run-script#155 ·
似ている issue
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
githubnext/gh-aw-workshop#6332 ·
メンテナーはふだん 1 日以内に返信
-
App Designer bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
avniproject/avni-webapp#1858 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 96/100
hiero-ledger/hiero-sdk-js#4834 ·
メンテナーはふだん 1 日以内に返信
-
[组件名称] 描述问题的标题オープン🐞 bug 🧐 unconfirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Tencent/tdesign-miniprogram#4744 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Y-axis tooltip hides near the bottom of the plot while the y crosshair stays visible対応中かも @lazerg が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apexcharts/apexcharts.js#5449 ·
メンテナーはふだん 3 日以内に返信