Skip to main content

Node.js system requirements

This page reflects the system requirements and capabilities of the latest version available on npmjs.com unless otherwise specified.

Before installing the Node.js agent confirm you can meet the following requirements:

  • There is a deployed application with a package.json file that has a name field, and Contrast supports the web application technology. The agent looks for package.json starting in the working directory of the Node.js process. If the file is somewhere else, set agent.node.app_root. If the file has no name, set application.name.

  • The agent has network connectivity with the Contrast server.

  • Install the agent with optional dependencies enabled. Do not use --omit=optional or --no-optional. Install on the same operating system, architecture and C library the application runs on, because npm installs the swc binary for the platform it runs on. If you build in one environment and deploy in another, install the agent in the deployment environment. If the binaries do not match, the agent logs Failed to load native binding and the application starts without the agent.

Requirement

Recommended

Notes

CPU

  • x64 on Linux, macOS and Windows

  • ARM64 on Linux and macOS

Windows on ARM64 or 32-bit Windows are not supported

The Node.js agent has limited support for running on macOS systems with the M1/M2 chip, though it does not yet support running Alpine-based docker containers on the Apple M1/M2 (ARM64).

Important

Using the Node.js agent will use more resources than your application on its own, and requires increasing the application's available CPU and memory due to the increased processing and analysis of inbound information. CPU load will also increase, but the specific application architecture and existing CPU usage profile heavily influence this.

If you are using Assess, you should double the available memory in each container compared to what you would normally use without the Contrast Node.js agent.

Operating system

  • Linux with glibc 2.28 or later, for example RHEL 8 and later, Ubuntu 20.04 and later, and Debian 10 and later

  • Alpine Linux on x64

  • Windows

  • macOS

Process managers

  • PM2: 4.5.0 and later and 5.1.0 and later

  • The Contrast Node.js agent supports running in both fork and cluster mode.

  • The start command used when running the Contrast Node.js agent must include the full path to the installed @contrast/agent module. For example:

    node --import /Users/michael/Dev/my-app/node_modules/@contrast/agent app.js

Containers

  • Distroless containers

  • Distroless container images do not include a shell which allows executing operating system commands. Node.js agent 5.19.0 and later reports libraries and findings even when you install it in an application that runs in a distroless container image.

The agent does not run when Node.js starts with a flag that begins with --experimental or --permission. The agent instruments the main thread only, so worker threads run without instrumentation.