[BUG] Crash in `npm install`
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, nodejs
- 领域
- build-system, cli
调研方向
The crash occurs in the npm CLI when network fetch fails in an offline, containerized Guix environment. Start by examining the error handling in lib/npm.js and the exit handler. Look at the stack trace pointing to make-fetch-happen and pacote modules. Reproduce the issue in a minimal Guix container to understand the exact conditions triggering the crash. The goal is to ensure a useful error message is shown instead of a crash.
由索引模型根据 Issue 内容生成。
描述
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
Using Guix to to build taler-util, npm install crashes like the following:
[...]
npm verbose cli /gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/bin/node /gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/bin/npm-cli.js
npm info using [email protected]
npm info using [email protected]
npm verbose title npm install
npm verbose argv "--loglevel" "verbose" "--offline" "--fetch-retries" "0" "--ignore-scripts" "--install-links" "--no-audit" "--prefix" "/tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/taler-util" "install"
npm verbose logfile logs-max:10 dir:/tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/npm-home-0/.npm/_logs/2026-09-24T05_24_04_331Z-
npm verbose logfile /tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/npm-home-0/.npm/_logs/2026-09-24T05_24_04_331Z-debug-0.log
npm http fetch GET https://registry.npmjs.org/npm attempt 1 failed with EAI_AGAIN
npm verbose cwd /tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/taler-util
npm verbose os Linux 7.1.8
npm verbose node v26.10.0
npm verbose npm v11.19.1
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error <https://github.com/npm/cli/issues>
npm verbose exit 1
npm verbose code 1
npm error A complete log of this run can be found in: /tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/npm-home-0/.npm/_logs/2026-09-24T05_24_04_331Z-debug-0.log
error: in phase 'configure': uncaught exception:
%exception #<&invoke-error program: "/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/bin/npm" arguments: ("--verbose" "--offline" "--fetch-retries=0" "--ignore-scripts" "--install-links" "--no-audit" "--prefix=/tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/taler-util" "install") exit-status: 1 term-signal: #f stop-signal: #f>
phase `configure' failed after 2.5 seconds
command "/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/bin/npm" "--verbose" "--offline" "--fetch-retries=0" "--ignore-scripts" "--install-links" "--no-audit" "--prefix=/tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/taler-util" "install" failed with status 1
Despite the package.json dependencies being patched to be absolute file names, which npm appears to be satisfied with, npm tries to reach to the network, fails (this happens in a containerized, isolated environment) and crashes without a useful error.
Expected Behavior
A useful error should be produced instead of a crash asking me to file a bug.
Steps To Reproduce
I'm using these components:
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
+ [email protected] [email protected]
I was not able to reproduce outside of the minimal Guix build container; at least it should be easy to reproduce with GNU Guix, which can run on top of any GNU/Linux distribution (to install, see: https://guix.gnu.org/manual/devel/en/guix.html#Binary-Installation-1, and use the guix-install.sh script).
guix time-machine -q --url=https://codeberg.org/guixotic/guix -commit=npm-crash-issue-10030-repro -- build -K taler-util
It should leave the failed build directory under /tmp/guix-build-taler-util-1.6.5.drv-0, which you can enter and try the same thing, this time outside the container.
cd /tmp/guix-build-taler-util-1.6.5.drv-0
. environment-variables
cd source/packages/taler-util
npm "--verbose" "--offline" "--fetch-retries=0" "--ignore-scripts" "--install-links" "--no-audit" "--prefix=/tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/taler-util" "install"
npm verbose cli /gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/bin/node /gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/bin/npm-cli.js
npm info using [email protected]
npm info using [email protected]
npm verbose title npm install
npm verbose argv "--loglevel" "verbose" "--offline" "--fetch-retries" "0" "--ignore-scripts" "--install-links" "--no-audit" "--prefix" "/tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/taler-util" "install"
npm verbose logfile logs-max:10 dir:/tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/npm-home-0/.npm/_logs/2026-09-24T08_47_32_149Z-
npm verbose logfile /tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/npm-home-0/.npm/_logs/2026-09-24T08_47_32_149Z-debug-0.log
npm verbose stack Error: request to https://registry.npmjs.org/typescript failed: cache mode is 'only-if-cached' but no cached response is available.
npm verbose stack at cacheFetch (/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/node_modules/make-fetch-happen/lib/cache/index.js:12:13)
npm verbose stack at async fetch (/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/node_modules/make-fetch-happen/lib/fetch.js:98:7)
npm verbose stack at async RegistryFetcher.packument (/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:90:19)
npm verbose stack at async RegistryFetcher.manifest (/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:128:23)
npm verbose stack at async RegistryFetcher.resolve (/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:55:5)
npm verbose stack at async #extractOrLink (/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:775:7)
npm verbose stack at async /gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:699:7
npm verbose stack at async Promise.allSettled (index 0)
npm verbose stack at async #reifyPackages (/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:353:11)
npm verbose stack at async Arborist.reify (/gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:139:7)
npm error code ENOTCACHED
npm error request to https://registry.npmjs.org/typescript failed: cache mode is 'only-if-cached' but no cached response is available.
npm verbose cwd /tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/taler-util
npm verbose os Linux 7.1.8
npm verbose node v26.10.0
npm verbose npm v11.19.1
npm verbose exit 1
npm verbose code 1
npm error A complete log of this run can be found in: /tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/npm-home-0/.npm/_logs/2026-09-24T08_47_32_149Z-debug-0.log
As you can see, it doesn't crash in this environment, so it looks like the minimal Guix build environment is key to trigger the crash.
I tried reproducing in a similar container via:
$ guix time-machine -q --url=https://codeberg.org/guixotic/guix -commit=npm-crash-issue-10030-repro -- shell --writable-root -CD taler-util
Which will leave you in a container, but it also won't reproduce.
Attached is the Guix build log;
node-26.10.0-crash-building-taler-util.log.txt
The npm log:
2026-09-24T06_00_55_521Z-debug-0.log
A strace of npm execution, strace -s800 -f [...]:
Environment
- npm: 11.19.1
- Node.js: 26.10.0
- OS Name: Guix System
- System Model Name: x86_64
- npm config:
$ npm config ls
; node bin location = /gnu/store/m8k90i2k51xbmbprf3s9vga0g1p39rwq-node-26.10.0/bin/node
; node version = v26.10.0
; npm local prefix = /tmp/guix-build-taler-util-1.6.5.drv-0/source
; npm version = 11.19.1
; cwd = /tmp/guix-build-taler-util-1.6.5.drv-0/source
; HOME = /tmp/guix-build-taler-util-1.6.5.drv-0/source/packages/npm-home-0
; Run `npm config ls -l` to show all defaults.
- 主要语言
- JavaScript
- 星标
- 10.3k
- 派生
- 5k
- 平均合并
- 4 天 11 小时
- 30 天内合并 PR
- 26
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
npm/cli 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 2 天内回复
-
[BUG] scripts/dependency-graph.js splits npm-cli-repos.txt on os.EOL, so DEPENDENCIES.md depends on the checkout's line endings可能已有人在做 @saruk-vedant 于 7 天前认领。 未关闭Bug Needs Triage Triage Requested
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复
-
[BUG] npm pkg delete removes the first array item for a nonexistent property可能已有人在做 @drawliin 于 42 天前认领。 未关闭cmd:delete Priority 3
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 2 天内回复
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings logged可能重新可做 关联的 PR 已关闭且未合并。 未关闭Engineering Priority 1
难度 1/5 1 小时以内 新手友好度 80/100
维护者通常 2 天内回复
-
`npm audit signatures` does not report how many packages it skipped for want of registry keys可能已有人在做 @greenlincoln05 于 63 天前认领。 未关闭Priority 3
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 2 天内回复
相似的 Issue
-
documentation
难度 1/5 1 小时以内 新手友好度 88/100
githubnext/gh-aw-workshop#6332 ·
维护者通常 1 天内回复
-
App Designer bug
难度 2/5 1-3 小时 新手友好度 78/100
avniproject/avni-webapp#1858 ·
-
bug
难度 1/5 1 小时以内 新手友好度 96/100
hiero-ledger/hiero-sdk-js#4834 ·
维护者通常 1 天内回复
-
[组件名称] 描述问题的标题未关闭🐞 bug 🧐 unconfirmed
难度 2/5 1-3 小时 新手友好度 68/100
Tencent/tdesign-miniprogram#4744 · 1 条评论 ·
维护者通常 1 天内回复
-
Y-axis tooltip hides near the bottom of the plot while the y crosshair stays visible可能已有人在做 @lazerg 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
apexcharts/apexcharts.js#5449 ·
维护者通常 3 天内回复