Windows: start fails because daemon path comes from URL.pathname

オープン 初心者向け
#64 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript
領域
cli

調査の方向性

まず packages/agent-react-devtools/src/daemon-client.ts の daemon パスの構築と古さのチェックを確認します。次に packages/agent-react-devtools/src/daemon.ts の buildMtime の stat を調べます。CLI が import.meta.url からどのようにパスを導出するか、Windows のドライブ文字やエンコードされた空白も含めて確認してください。issue では fileURLToPath が意図された変換方法として示されています。daemon スクリプトのパスが Windows で有効になり、空白を含むパスへのインストールが機能すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Summary

On Windows, start always fails with Daemon failed to start within 5 seconds. The CLI builds the daemon script path from new URL(import.meta.url).pathname, which is not a valid file path on Windows.

Environment

  • agent-react-devtools 0.5.0 (same code on main @ d25f34b)
  • Node 26.8.1
  • Windows 11 (10.0.26100)

Repro

> agent-react-devtools start --port 8098
Daemon failed to start within 5 seconds

The spawned daemon exits at once. Running the same spawn by hand shows why:

script: \D:\temp\ard\node_modules\agent-react-devtools\dist\daemon.js
Error: Cannot find module 'D:\D:\temp\ard\node_modules\agent-react-devtools\dist\daemon.js'

Cause

new URL('file:///D:/x/cli.js').pathname is /D:/x/cli.js. After path.join it becomes \D:\x\... (leading backslash), which Node resolves to D:\D:\x\.... pathname also keeps percent-encoding, so an install under a path with spaces breaks on any OS:

url:           file:///C:/Program%20Files/nodejs/node_modules/agent-react-devtools/dist/cli.js
pathname:      \C:\Program%20Files\nodejs\node_modules\agent-react-devtools\dist\daemon.js
fileURLToPath: C:\Program Files\nodejs\node_modules\agent-react-devtools\dist\daemon.js

Locations:

Fix

Use fileURLToPath(import.meta.url) from node:url. With that change the daemon spawns on Windows, but it then fails on the IPC socket (https://github.com/callstackincubator/agent-react-devtools/issues/65).

主要言語
TypeScript
スター
251
フォーク
13
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

callstackincubator/agent-react-devtools のほかの issue

callstackincubator/agent-react-devtools の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。