When searching for memory allocation error happening the TypeScript compiler (
tsc), you'll see that it's possible to increase the memory limit of the node process. But how do you proceed to increase the memory limit for the
tsc call? Just follow these steps:
In your terminal, run
which tsc, to see where the
tsc binary is located.
$ which tsc /usr/local/bin/tsc
Great. Now let's edit the contents of the
tsc binary. In Unix, the file looks like this:
1 #!/usr/bin/env node 2 require('../lib/tsc.js')
Simply add the size increase after the node call:
node --max-old-space-size=4096 .
Your file should look like this:
1 #!/usr/bin/env node --max-old-space-size=4096 2 require('../lib/tsc.js')
Save and close the file. Now you should have increased the memory limit for
tsc calls now.