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 小時 31 分鐘
- 30 天內合併 PR
- 168
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 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 天內回覆
-
難度 4/5 3-5 天 新手友好度 52/100
angular/angular-cli#34207 ·
維護者通常 1 天內回覆
-
area: @angular/build gemini-triaged
難度 4/5 3-5 天 新手友好度 48/100
angular/angular-cli#34198 ·
維護者通常 1 天內回覆
-
library builder: tslib is not added to the output package.json可能已有人在做 @alan-agius4 於 9 天前認領。 未關閉angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 angular/angular-cli 的全部 Issue
相似的 Issue
-
refactor
難度 2/5 半天 新手友好度 84/100
維護者通常 5 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
OHDSI/Data2Evidence#3450 ·
維護者通常 2 天內回覆
-
e2e-failure ready-to-code
難度 2/5 1-3 小時 新手友好度 90/100
redhat-developer/rhdh-plugin-export-overlays#4011 · 1 則留言 ·
維護者通常 1 天內回覆
-
automation missing-model model-sync provider:ofox
難度 2/5 1-3 小時 新手友好度 72/100
anomalyco/models.dev#8421 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆