ng build --watch --preserve-symlinks dies with EMFILE when watch mode starts
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 70/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- angular, node.js, typescript
- 领域
- build-system, cli, tooling
调研方向
Start by tracing setupWatcher and its chokidar ignore configuration, then reproduce the issue with ng build --watch --preserve-symlinks on the described monorepo. Done means the shared directory symlink remains watched while unrelated node_modules directories no longer exhaust file handles; add or update the relevant watcher test if one is found there.
由索引模型根据 Issue 内容生成。
描述
Hi team,
We have one monorepo. A web app and an API both compile a shared model folder. That folder has no package.json. The web app reaches it through a symlink, libs/model, pointing at ../../model next to the web app. The watch command is ng build --watch --preserve-symlinks. We need preserveSymlinks so that link keeps working. On 22.1.7 this watch runs fine.
After moving @angular/cli and @angular/build to 22.2.0, the bundle still completes (about 92 seconds). Then the process dies as soon as watch mode starts:
Watch mode enabled. Watching for file changes...
Error: EMFILE: too many open files, watch
at FSWatcher._handle.onchange (node:internal/fs/watchers:267:21)
The stack goes through chokidar. We're on macOS, Node 24.16.0. ulimit -n 65536 does not stop it.
22.2 uses chokidar for this case so a directory symlink is still rebuilt. That part is what #34060 fixed for #34039, and the rebuilds do show up. The new problem is everything else the watcher opens. In setupWatcher, **/node_modules/** is only added to the ignore list when preserveSymlinks is false. The comment says that is so npm link keeps working. With the flag on, chokidar calls fs.watch for every directory under node_modules. Ours is large enough that the process runs out of file handles.
This symlink is not an npm link, and it is not inside node_modules. Ignoring node_modules would still follow libs/model to the shared model folder. Could the watcher skip node_modules when preserveSymlinks is on, and only watch a package that was actually created with npm link?
We've gone back to 22.1.7 for now.
- 主要语言
- TypeScript
- 星标
- 27k
- 派生
- 11.8k
- 平均合并
- 21 小时 32 分钟
- 30 天内合并 PR
- 162
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
angular/angular-cli 的其他 Issue
-
area: @angular/build gemini-triaged
难度 2/5 1-3 小时 新手友好度 74/100
angular/angular-cli#33955 ·
维护者通常 1 天内回复
-
area: @angular/cli gemini-triaged
难度 2/5 1-3 小时 新手友好度 72/100
angular/angular-cli#33055 · 1 条评论 · 3 个 reaction ·
维护者通常 1 天内回复
-
area: @angular-devkit/build-angular gemini-triaged
难度 3/5 1-2 天 新手友好度 68/100
angular/angular-cli#34195 ·
维护者通常 1 天内回复
-
library builder: tslib is not added to the output package.json可能已有人在做 @alan-agius4 于 8 天前认领。 未关闭angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 已指派 1 人 ·
维护者通常 1 天内回复
-
library builder: a name re-exported through two "export *" paths is dropped from the bundle可能已有人在做 @alan-agius4 于 8 天前认领。 未关闭angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 angular/angular-cli 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
openedx/frontend-app-authoring#3274 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
-
area/documentation status/need-triage
难度 1/5 1 小时以内 新手友好度 95/100
google-gemini/gemini-cli#29548 ·
维护者通常 1 天内回复
-
sdk-typescript vector-store
难度 2/5 半天 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复