Any tips to reduce memory usage for `npm run org`?

I’ve set up a new freesewing development environment on an aarch64 macbook running macos. I use this machine primarily for java development and personal use so don’t want to install node/npm globally, instead I set up a devcontainer for use with vscode based on the nodejs+javascript images provided by microsoft. This mostly works (except port forwarding isn’t working right) and I can run the dev or studio sites without issue.

Running org fails with an error 137, usually partway through the post-launch build:

> orgdocs@0.0.0 start
> docusaurus start --host 0.0.0.0

[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/

● Client █████████████████████████ building (46%) 2/3 entries 467/540 dependencies 133/201 modules 1 active 
 babel-loader › .docusaurus/routes.js

Killed
npm error Lifecycle script `start` failed with error:
npm error code 137
npm error path /workspaces/freesewing/sites/org
npm error workspace orgdocs@0.0.0
npm error location /workspaces/freesewing/sites/org
npm error command failed
npm error command sh -c docusaurus start --host 0.0.0.0

I’m on a laptop with 24GB of memory with docker desktop set to use ~8GB of memory and the devcontainer has about ~6GB available after the other services I normally have running. It seems that the container ends up needing 8.09GB at peak and 7.6GB when running org, requiring an increase in the global memory limit as well as killing some other containers.

This seems a little excessive, though I don’t normally use npm serve in the day job (usually java/spring/tomcat with clientside code packaged as part of the build). Is there any way to get npm to use less memory during the build even if it makes compilation take a bit longer? Should it release memory when it finishes the build and is handling requests?

Short term, I recommend running NodeJS 22 which in my experience results in a lower footprint.

Long(er) term, I think we’re all staking our hopes on: https://github.com/facebook/docusaurus/issues/4765