memoryLimit and maxWorkers options are available for nx serve
Using --memoryLimit flag causes an error like this:
Schema validation failed with the following errors:
Data path "" should NOT have additional properties(maxWorkers).
Please provide detailed steps for reproducing the issue.
nx serve --maxWorkers=1Please provide any relevant information about your setup:
@nrwl/angular : Not Found
@nrwl/cli : 9.2.2
@nrwl/cypress : Not Found
@nrwl/eslint-plugin-nx : 9.1.2
@nrwl/express : Not Found
@nrwl/jest : 9.2.2
@nrwl/linter : 9.2.1
@nrwl/nest : 9.2.2
@nrwl/next : Not Found
@nrwl/node : 9.2.1
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.2.2
@nrwl/web : Not Found
@nrwl/workspace : 9.2.2
typescript : 3.8.3
Ref #2716: It would be great to have those flags not only work for building but also serving an application. My development machine only has so much RAM available and I'm constantly hitting 95-99% RAM usage while developing inside WSL 2. Plus, I really don't need 6 workers@2GB, it's too much.
Maybe it's a usage problem and this is possible, if so, where can I find this in the documentation?
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nrwl community! 馃檹
Reply to keep this active
Can we add this to angular and nestjs. Nx is obliterating my RAM when tyring to run my nestjs.
is there any update?
My laptop is 16gb but it is DIEing very badly
@yeomann Had the same issue. I was able to prevent my project from creating 14+ workers by using this option in my angular.json
my-project.architect.build.options {... other options, "maxWorkers": 1 }
It helps with the workers my memory consumption is still high and even more when you use VS, Chrome, and Nx :(
thanks man @alexesca
i am using nx with Nest project, added in workspace.json for the main "architect.build.options" and it worked.
nice trick
edit:
i added memoryLimit as well, seems to be working


Hey @yeomann,
Does this rule apply too when building the project?
i have not tested @ericgoe
@ericgoe It is defined in the build. I had this issue when running nx serve, but then I realized that nx serve has to build the project before serving it. The "maxWorkers" and "memoryLimit" in the build option help with any other commands that use build in the pipeline process.
Most helpful comment
is there any update?
My laptop is 16gb but it is DIEing very badly