ng build --watch --preserve-symlinks dies with EMFILE when watch mode starts
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 70/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- angular, node.js, typescript
- Domaine
- build-system, cli, tooling
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 20 h 38 min
- PR mergées (30 j)
- 154
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-serverOuvertearea: @angular/build gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
angular/angular-cli#33955 ·
Les mainteneurs répondent en général sous 1 jour
-
area: @angular/cli gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
angular/angular-cli#33055 · 1 commentaire · 3 réactions ·
Les mainteneurs répondent en général sous 1 jour
-
area: @angular/build gemini-triaged
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
angular/angular-cli#34166 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
library builder: tslib is not added to the output package.jsonPeut-être pris @alan-agius4 l’a pris il y a 7 jours. Ouverteangular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
library builder: a name re-exported through two "export *" paths is dropped from the bundlePeut-être pris @alan-agius4 l’a pris il y a 7 jours. Ouverteangular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de angular/angular-cli
Issues similaires
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
StabilityNexus/Fate-EVM-Frontend#153 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
code-yeongyu/oh-my-openagent#9039 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
Tencent/teamai-cli#862 ·
Les mainteneurs répondent en général sous 1 jour
-
bug good first issue hacktoberfest redis
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
libredb/libredb-studio#1164 ·
Les mainteneurs répondent en général sous 1 jour
-
flake
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
coder/xum#4920 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour