title: Nodejs - Increase heap size in express.js project
body: <p>I have an express.js project (typescript) with the following commands to package.json</p>
  
  <pre><code>"scripts": {
      "start": "npm run build &amp;&amp; npm run watch",
      "build": "npm run build-ts &amp;&amp; npm run tslint",
      "serve": "nodemon dist/server.js",
      "watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run serve\"",
      "test": "jest --forceExit",
      "build-ts": "tsc",
      "watch-ts": "tsc -w",
      "tslint": "tslint -c tslint.json -p tsconfig.json",
      "debug": "npm run build &amp;&amp; npm run watch-debug",
      "serve-debug": "nodemon --inspect dist/server.js",
      "watch-debug": "concurrently -k -p \"[{name}]\" -n \"Sass,TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run serve-debug\"",
      "angular-build": "cd app &amp;&amp; ng build --prod --output-path=../dist/app/ --deploy-url= --no-progress --aot true"
  },
  </code></pre>
  
  <p>I know that the command to increase heap memory size is --max-old-space-size but i don't know where to put it....</p>
  
  <p>All the examples i saw are</p>
  
  <pre><code>node --max-old-space-size=4096 myapp.js
  </code></pre>
  
  <p>but I don't run my app this way... I just run "npm start"</p>
  
  <p>I use this code to check the current heap size</p>
  
  <pre><code>let v8 = require("v8");
  let totalHeapSizeInGB = (((v8.getHeapStatistics().total_available_size) / 1024 / 1024 / 1024).toFixed(2));
  console.log(`*******************************************`);
  console.log(`Total Heap Size ~${totalHeapSizeInGB}GB`);
  console.log(`*******************************************`);
  </code></pre>