• /
  • EnglishEspañolFrançais日本語한국어Português
  • 로그인지금 시작하기

Install the Node.js agent

|View as Markdown (English)

The Node.js agent is publicly available on the npm repository and on GitHub.

팁

Using Docker? See Install the Node.js agent in Docker.

Prerequisites

Check these requirements before you start.

Requirement

Details

New Relic account

You need a New Relic account and your . Have it ready before you begin.

Node.js version

See Node.js agent compatibility and requirements for supported Node.js versions.

Install the agent

Install the agent package in your application directory:

bash
$
npm install newrelic

중요

If you use Next.js, refer to the Next.js hybrid agent instrumentation guide.

Then copy the default configuration file from the package into the root of your application:

bash
$
cp node_modules/newrelic/newrelic.js .

Configure the agent

Open newrelic.js in the root of your application. The only two settings you must change before going live:

  1. Set license_key to your .

  2. Set app_name to a meaningful name for your application.

    exports.config = {
    app_name: ['Your Application Name'],
    license_key: 'YOUR_LICENSE_KEY',
    // ...
    }

    You can also set these via environment variables instead of editing the file:

    bash
    $
    NEW_RELIC_APP_NAME="Your Application Name"
    $
    NEW_RELIC_LICENSE_KEY="YOUR_LICENSE_KEY"

Start the agent

Load the agent before any other require statements by adding -r newrelic to your startup command:

bash
$
node -r newrelic ./your-app.js

If your application uses ESM, add the --import newrelic/esm-loader.mjs option:

bash
$
node --import newrelic/esm-loader.mjs -r newrelic ./your-app.js

For a Next.js app, load our agent via NODE_OPTIONS='-r newrelic' next start.

If you're using Nest.js and the nest start command to start the application, modify its startup binary to load the New Relic agent: nest start --exec 'node -r newrelic'. Here is an example Nest.js application.

Verify data is flowing

If your agent version is 14.9.0 or above, you can run this command to validate your configuration:

bash
$
npx newrelic validate-config --config-file ./newrelic.js
  1. Send at least two requests to your application.

  2. Wait 2–3 minutes, then open one.newrelic.com > APM and look for your app by name.

Copyright © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.