Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

ng build --watch --preserve-symlinks dies with EMFILE when watch mode starts

Geschlossen
#34,185 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
70/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

area: @angular/build gemini-triaged

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.

Vorherrschende Sprache
TypeScript
Sterne
27k
Forks
11.8k
Ø Merge
21 Std. 32 Min.
Gemergte PRs (30 T.)
162

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus angular/angular-cli

Alle Issues in angular/angular-cli

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.