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

Why does `>1.2` throw as an invalid comparator?

Đang mở
#802 19 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
javascript, node.js
Lĩnh vực
tooling

Hướng nghiên cứu

Start with test/fixtures/range-exclude.js at line 68 and classes/comparator.js at lines 37-42, then reproduce the npx command and trace how the range is parsed. Compare the observed comparator handling with the expected range semantics and determine whether the result should be explained, covered by a regression test, or corrected.

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

Mô tả

https://github.com/npm/node-semver/blob/d17aebf8485edfe9dda982dab578c603d031e4ab/test/fixtures/range-exclude.js#L68

I am trying to understand why npx -r '>1.2' 1.2.8 results in 1.2.8 not satisfying the range. I think >1.2 should expand to >1.2.0 <1.3.0 which would mean 1.2.8 satisfies. But stepping through the tool, I see it hits this path:

https://github.com/npm/node-semver/blob/d17aebf8485edfe9dda982dab578c603d031e4ab/classes/comparator.js#L37-L42

The result being m === null and the TypeError is thrown.

Ngôn ngữ chính
JavaScript
Star
5.5k
Fork
598
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

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 npm/node-semver

Tất cả issue của npm/node-semver

Issue tương tự

Thêm issue về JavaScript

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.