Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Cerrado
#34,185 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
70/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
angular, node.js, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
27k
Forks
11.8k
Merge medio
20 h 38 min
PR fusionados (30 d)
154

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de angular/angular-cli

Todos los issues de angular/angular-cli

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.