Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

361
Vistas
How to set max-old-space-size for typescript compiler (tsc)?

I have tsc job failing on gitlab ci with FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

The script I'm running is tsc -p test/tsconfig.json --noEmit

What I've tried so far is to increase max-old-space-size via:

  1. cross-env NODE_OPTIONS=--max-old-space-size=8192 yarn print:heapsize && tsc -p test/tsconfig.json --noEmit
  2. cross-env NODE_OPTIONS='--max-old-space-size=8192' yarn print:heapsize && tsc -p test/tsconfig.json --noEmit (just extra quotes around var)
  3. node --max-old-space-size=8192 ./node_modules/.bin/tsc -p test/tsconfig.json --noEmit

Options #1 and #2 doesn't work, and #3 works fine, but it doesn't sound okay to me to run the binary and pass param to the node cli

So my question is - how do I set max-old-spce-size for tsc via env variables or maybe there is another good way to do it?

yarn print:heapsize is the script I used to check current size - it shows 8gb for both #1 and #2 here it is:

"print:heapsize": "node -e \"console.log('🔥 Current heap size:', (require('v8').getHeapStatistics().total_available_size / 1024 / 1024 / 1024).toFixed(2), 'Gb')\""

and here's the output enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

The first two options fail because the environment variable NODE_OPTIONS=--max-old-space-size=8192 applies only to the first command (yarn print:heapsize) that is before &&.

If you remove yarn print:heapsize && the environment will apply to the compilation command as expected:

cross-env NODE_OPTIONS=--max-old-space-size=8192 tsc -p test/tsconfig.json --noEmit

about 4 years ago · Juan Pablo Isaza Denunciar

0

tsc is deprecated but you can use ts-node with --max-old-space-size in NODE_OPTIONS

Add this options in your package.json

{
  "scripts": {
    "start": "NODE_OPTIONS='--max-old-space-size=8192' ts-node index.ts"
   }
}  
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda