Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Support for Android / Termux (`process.platform === 'android' `)

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

@kukirin-ui đang làm issue này rồi.

Từ ngày 15/10/2026.

  • #275 của @kukirin-ui — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một 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ệ
android, nodejs, typescript
Lĩnh vực
cli, operating-systems

Hướng nghiên cứu

Lỗi crash đến từ bảng ánh xạ nền tảng OSService và hàm trợ giúp getOS cung cấp dữ liệu cho bảng đó, mà báo cáo xác định nằm trong mã nguồn đã công bố ở v0.12.2. Bắt đầu bằng việc tìm nơi getOS được định nghĩa và cách bảng ánh xạ được truy cập theo khóa, sau đó kiểm tra những khóa nào tồn tại cho android. Hoàn thành khi process.platform đặt là android trả về một service mà không gặp lỗi is not a constructor, bạn có thể xác nhận điều này bằng một unit test nhỏ giả lập (stub) process.platform.

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

Mô tả

Describe the bug

When running npkill on Termux (Android), it crashes immediately with:

TypeError: OSService[getOS(...)] is not a constructor
Root cause

Node.js on Termux reports process.platform === 'android'.

In the published package (v0.12.2) the platform map only contains:

const OSService = {
  linux: LinuxFilesService,
  win32: WindowsFilesService,
  darwin: MacFilesService,
};

So OSService['android'] is undefined.

Suggested fix

Treat Android the same as Linux (it is Linux under the hood and the existing LinuxFilesService works correctly after the patch).

Minimal patch (works on current published version):

// before
const getOS = () => process.platform;

// after
const getOS = () => 
  process.platform === 'android' ? 'linux' : process.platform;

Alternatively, just add the key:

const OSService = {
  linux: LinuxFilesService,
  android: LinuxFilesService,   // ← add this
  win32: WindowsFilesService,
  darwin: MacFilesService,
};
Environment
  • Termux on Android
  • Node.js v24.x (also reproduces on earlier versions)
  • npkill 0.12.2
Additional context

After applying the one-line change above, npkill starts and works normally on Termux.

NB. Grok xAI found the line and wrote the above.

Proof that works:

-----                    __   .__.__  .__
-           ____ ______ |  | _|__|  | |  |
------     /    \\____ \|  |/ /  |  | |  |        Releasable space: 0.00 GB
----      |   |  \  |_> >    <|  |  |_|  |__      Space saved: 0.00 GB
--        |___|  /   __/|__|_ \__|____/____/      Search completed 0.36s
-------        \/|__|        \/       0.12.2                               
                                                                   
  CURSORS for select - SPACE to delete                                                                                                                                                          Last_mod   Size   


on Termux above

Ngôn ngữ chính
TypeScript
Star
9.5k
Fork
257
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
2

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

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 voidcosmos/npkill

Tất cả issue của voidcosmos/npkill

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.