Downloading the Node.js Agent
Our Node.js agents (slnodejs
) are published in the npm registry. You download it and all its dependencies using the standard npm
commands.
From the various ways to install it, the installer utility is the recommended best practice.
Downloading the latest version from npm
To always get the newest published version, install directly from npm:
npm i slnodejs
This is useful for testing the latest features, but it may differ from the recommended version set in your dashboard.
Installing the predefined agent version via the installer utility (Best Practice)
Use the slnodejs-installer
package to automatically install the agent version configured in your SeaLights Dashboard Settings page. This avoids manual scripting and keeps your pipelines aligned with your chosen version.
To run the installer, you must provide your SeaLights Agent Token either by placing a file named sltoken.txt
in the project root or by setting it as the environment variable SL_TOKEN
.
# Retrieve the SeaLights Agent Token from your vault/secret manager
export SL_TOKEN=$(vault kv get -field=token secret/sealights)
# Install the agent version defined in your SeaLights Settings
npm install slnodejs-installer
npm list | grep slnodejs
The installer authenticates with your token, retrieves the predefined agent version from your Settings, and installs that exact slnodejs
version from npm. It also records details in an install.log
file in the current directory for troubleshooting.
Installing the recommended version via API (Alternative)
If you prefer scripting, you can query the SeaLights Public API to fetch the recommended version and install it:
# Retrieve the SeaLights Agent Token from your vault/secret manager
export SL_TOKEN=$(vault kv get -field=token secret/sealights)
# Fetch Agent version defined in Sealights dashboard settings
$SLVERSION=$(curl -X GET "https://$DOMAIN.sealights.co/api/v2/agents/slnodejs/recommended" -H "accept: application/json" -H "Authorization: Bearer $SL_TOKEN" -L)
# Install Sealights Agent (Recommended version)
npm i slnodejs@$SLVERSION
npm list | grep slnodejs | sed 's/[^a-zA-Z0-9\-]*//;s/@/ version: /'
Last updated
Was this helpful?