Last Updated: August 16, 2018
· endel
Profile 2015 2

Increasing TypeScript memory limit (Allocation failed - process out of memory)

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

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.

Say Thanks

2 Responses
Add your response

3 months ago ·

I have read through your blog, your blog is very or very detailed it, thank you for sharing, I hope to read more of this good blog.

about 5 hours ago ·