I have an JavaScript heap out of memory error. How to resolve?

Sometimes, when processing a large data set, for example a large CSV file (~>100Mb), you may face nodejs memory issue, such as: "Allocation failed - JavaScript heap out of memory".

In this case you need to extend the memory allocation limit for the nodejs processes by executing the following command in the Terminal/Console:

# For the Windows OS:
set NODE_OPTIONS=--max-old-space-size=8192
# For the MAC/LINUX OS:
export NODE_OPTIONS=--max-old-space-size=8192

This example of the command extends the maximum allowed memory size up to 8Gb.

Last updated on Sa Oct 2022