NodeJS - JavaScript heap out of memory
Problem
When running the SeaLights NodeJS agent, the error "JavaScript heap out of memory
" is encountered.
Solution
By default node is limited in the amount of memory it is allocated, and sometimes the SeaLights node agent requires more memory that what was allocated.
More memory can be allocated by using theĀ max-old-space-size
flag.
The flag can be passed either by using the NODE_OPTION environment variable, for example:
Linux
export NODE_OPTIONS=--max-old-space-size=4096
Windows
set NODE_OPTIONS=--max-old-space-size=4096
Ā
Alternatively, it can be passed directly to node process running the SeaLights agent, for example:
node --max-old-space-size=4096 ./node_modules/.bin/slnodejs scan ...