one option: npm startup scripts
https://docs.npmjs.com/misc/scripts
They are added to your package.json package in the scripts section.
{ //other package.json stuff "scripts":{ "start": "node --max-old-space-size=4076 server.js" } }
then start the npm start call instead of typing in node + args + execution points.
Note: if you call it something other than run, npm run [yourScriptNameHere] will be the command to run
This is a better option than trying to reconfigure node to use 4gb by default (I donβt even know if its tbh is possible). This makes your configuration portable using the baked methods in their current form and allows others who encounter your code in the future to understand this is a necessity.
James leclair
source share