[BUG] scripts/dependency-graph.js splits npm-cli-repos.txt on os.EOL, so DEPENDENCIES.md depends on the checkout's line endings
Maintainer thường phản hồi trong vòng 2 ngày
@saruk-vedant đang làm issue này rồi.
Từ ngày 23/11/2026.
Đá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ệ
- javascript, node.js
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Bắt đầu với scripts/dependency-graph.js, nơi scripts/npm-cli-repos.txt được tách bằng os.EOL, và đọc cách scripts/resetdeps.js tạo các tệp dependency. Thử tái hiện với đầu vào LF và CRLF, sau đó kiểm tra xem cả hai lần chạy có giữ cho DEPENDENCIES.md và DEPENDENCIES.json khớp với các tệp đã được commit hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
This is not just a request to bump a dependency for a CVE
- This is not solely a request to bump a dependency for a CVE
Current Behavior
On Windows, in a clone whose scripts/npm-cli-repos.txt has LF endings, node ./scripts/resetdeps.js leaves DEPENDENCIES.md and DEPENDENCIES.json modified: 139 lines are removed from DEPENDENCIES.md, among them edges between npm's own packages such as bin-links-->cmd-shim and cacache-->ssri. On Linux the same happens with the file in CRLF.
The file is split on os.EOL: https://github.com/npm/cli/blob/787f1520fa412e91a5792468f1c7f25b166867a6/scripts/dependency-graph.js#L12
Expected Behavior
DEPENDENCIES.md and DEPENDENCIES.json come out as committed whichever line endings scripts/npm-cli-repos.txt has, as they already do when its endings match os.EOL.
Steps To Reproduce
Steps to reproduce, on Windows:
- Clone npm/cli with LF line endings:
git clone --branch latest -c core.autocrlf=input https://github.com/npm/cli.git, thencd cli. node ./scripts/resetdeps.jsgit diff --stat
Actual result: step 3 lists DEPENDENCIES.md and DEPENDENCIES.json as modified.
Expected result: step 3 lists nothing.
Reproducer: https://gist.github.com/YevheniiKotyrlo/0ac725143c5278c8c30925c41986905b — bash repro.sh (Git Bash on Windows, or Linux) clones latest, runs node ./scripts/resetdeps.js, then node . run dependencies with scripts/npm-cli-repos.txt written in LF and in CRLF, and compares both files with the committed ones, line endings aside. It exits 1 while the two runs give different files, 0 once both match the committed ones.
Its output on Windows 11:
$ git clone --depth 1 --branch latest https://github.com/npm/cli.git
npm/cli 787f152 (npm 12.2.3), node v26.12.1, win32 10.0.26300, os.EOL "\r\n"
$ node ./scripts/resetdeps.js
$ node . run dependencies --ignore-scripts # scripts/npm-cli-repos.txt in LF
DEPENDENCIES.md: 139 lines removed, 6 added
DEPENDENCIES.json: 52 lines removed, 12 added
$ node . run dependencies --ignore-scripts # scripts/npm-cli-repos.txt in CRLF
DEPENDENCIES.md: as committed
DEPENDENCIES.json: as committed
edges missing from DEPENDENCIES.md with LF, among them:
< bin-links-->cmd-shim;
< cacache-->ssri;
RESULT: DEPENDENCIES.md DEPENDENCIES.json differ between scripts/npm-cli-repos.txt in LF and in CRLF
On Linux (Docker node:26):
$ git clone --depth 1 --branch latest https://github.com/npm/cli.git
npm/cli 787f152 (npm 12.2.3), node v26.13.1, linux 6.18.58.1-microsoft-standard-WSL2, os.EOL "\n"
$ node ./scripts/resetdeps.js
$ node . run dependencies --ignore-scripts # scripts/npm-cli-repos.txt in LF
DEPENDENCIES.md: as committed
DEPENDENCIES.json: as committed
$ node . run dependencies --ignore-scripts # scripts/npm-cli-repos.txt in CRLF
DEPENDENCIES.md: 139 lines removed, 6 added
DEPENDENCIES.json: 52 lines removed, 12 added
edges missing from DEPENDENCIES.md with CRLF, among them:
< bin-links-->cmd-shim;
< cacache-->ssri;
RESULT: DEPENDENCIES.md DEPENDENCIES.json differ between scripts/npm-cli-repos.txt in LF and in CRLF
Environment
- npm: 12.2.3 (npm/cli
latestat 787f152) - Node.js: v26.12.1
- OS Name: Windows 11 Pro (win32 10.0.26300)
- System Model Name: custom-built x64 desktop
- npm config:
; "project" config from <clone>/.npmrc
package-lock = true
; "env" config from environment
cache = "<npm cache folder>"
userconfig = "<an empty file>"
; node version = v26.12.1
; npm version = 12.2.3
- Ngôn ngữ chính
- JavaScript
- Star
- 10.3k
- Fork
- 5k
- Merge trung bình
- 4 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của npm/cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] npm pkg delete removes the first array item for a nonexistent propertyCó thể đã có người làm @drawliin đã nhận 42 ngày trước. Đang mởcmd:delete Priority 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 2 ngày
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings loggedCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởEngineering Priority 1
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 2 ngày
-
`npm audit signatures` does not report how many packages it skipped for want of registry keysCó thể đã có người làm @greenlincoln05 đã nhận 63 ngày trước. Đang mởPriority 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] E401 error message does not use the configured registryCó thể đã có người làm @toufiq-dev đã nhận 66 ngày trước. Đang mởBug Priority 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
docs: add SECURITY.md vulnerability reporting policyCó thể đã có người làm @AK-Lmn đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
flisk-sh/linux2wasm#12 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
possible bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Mintplex-Labs/anything-llm#7388 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 60/100
Maintainer thường phản hồi trong vòng 1 ngày
-
v6: Minified bootstrap.min.css is missing header infoCó thể đã có người làm @lazerg đã nhận hôm nay. Đang mởbug build confirmed has-pr v6
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
githubnext/gh-aw-workshop#6332 ·
Maintainer thường phản hồi trong vòng 1 ngày