/
NodeJS - JavaScript heap out of memory

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 ...

Related articles







Related content

Sealights Node.js agent - dryRun command for troubleshooting and validation
Sealights Node.js agent - dryRun command for troubleshooting and validation
More like this
Configuring your Pull Request flow to report to SeaLights
Configuring your Pull Request flow to report to SeaLights
Read with this
Using Node.js Agents - Scanning a build
Using Node.js Agents - Scanning a build
More like this
SeaLights Node.js agent
SeaLights Node.js agent
Read with this
Using Node.js Agent - Generating a session ID
Using Node.js Agent - Generating a session ID
More like this
Merge multiple NYC coverage files into one
Merge multiple NYC coverage files into one
Read with this