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

Đang mở Phù hợp với người mới
#64 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với packages/agent-react-devtools/src/daemon-client.ts tại phần tạo đường dẫn daemon và kiểm tra lỗi thời, sau đó xem xét thống kê buildMtime trong packages/agent-react-devtools/src/daemon.ts. Kiểm tra cách CLI suy ra đường dẫn từ import.meta.url, bao gồm ký tự ổ đĩa Windows và khoảng trắng được mã hóa; issue xác định fileURLToPath là cách chuyển đổi dự kiến. Hoàn tất khi đường dẫn tập lệnh daemon hợp lệ trên Windows và cài đặt hoạt động trong các đường dẫn có khoảng trắng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
TypeScript
Star
251
Fork
13
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của callstackincubator/agent-react-devtools

Tất cả issue của callstackincubator/agent-react-devtools

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.