title: Nestjs "Reached heap limit Allocation failed - JavaScript heap out of memory" on npm run build
body: <p>I have an issue with my Nest js API.</p>
  <p>When I build in local, all works fine and I can build and start the development server without problems, but when I go to my server I can't build or start the development server.</p>
  <p>When I try to run &quot;npm run build&quot;,&quot;yarn build&quot; or start the server with &quot;yarn start&quot; the node returns to me this error:</p>
  <p><a href="https://i.stack.imgur.com/38JJQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/38JJQ.png" alt="enter image description here" /></a></p>
  <p>I tried to run &quot;export NODE_OPTIONS=--max_old_space_size=4096&quot; and in the ~/.bashrc export de node options with more space. Also, i upgraded all dependencies, and deleted and installed again, but nothing works. I have the same issue with the frontend of this project that uses Next JS.</p>
  <p>The server is an aws EC2 t3.small server with Ubuntu 20.04.3 LTS, the node version is v17.3.0, the npm version is 8.3.0 and the yarn version is 1.22.17.</p>
  <p>When I run &quot;tsc --extendedDiagnostics --noEmit&quot; i have 20 errors from node_modules/@nestjs/config, I tried to update the package but doesn't work:</p>
  <p><a href="https://i.stack.imgur.com/fIfCA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fIfCA.png" alt="enter image description here" /></a></p>
  <p>And finally, I get this summary:</p>
  <p><a href="https://i.stack.imgur.com/xoHnf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xoHnf.png" alt="enter image description here" /></a></p>
  <p>Thanks</p>