Closed aroshanzamir closed 1 year ago
You can check the stack overflow https://stackoverflow.com/questions/8965606/node-and-error-emfile-too-many-open-files. If you are on linux , the answer is to increase the file watchers
We had the exact same issue on our CI (on local build was fine), I managed to resolve the issue by deactivating watch feature on translation json files (increase ulimit on machine, or docker build was not working). We do not need to have a watch feature on build, but maybe there is a leak, or something to deactivate on nest build to avoid this kind of issue.
app.module.ts
I18nModule.forRoot({
fallbackLanguage: 'en',
loaderOptions: {
path: path.join(__dirname, '/i18n/'),
watch: false, // <------ This flag
},
resolvers: [new QueryResolver(['locale']), AcceptLanguageResolver],
}),
And today we had again this issue, and resolved it by disabling this flag too in nest-cli.json
:
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true,
"assets": [{ "include": "i18n/**/*", "watchAssets": false }] <----- watchAssets flag
}
}
After running (npm run build), I get the following error:
How can I solve it?