Install the Node.js agent

New Relic's Node.js agent is publicly available on the Node Package Manager (npm) repository as well as on New Relic's GitHub repo for Node.js. Before you install the Node.js agent, make sure your application meets New Relic's system requirements. You may also want to watch the installation video before you begin.

Install the Node.js agent

If you are using the agent in a Docker container, install the agent within each container.

To install the Node.js agent for New Relic:

  1. Ensure you meet the system requirements. In particular, ensure you are using a supported version of Node.
  2. Use the command npm install newrelic --save for each application you want to monitor.
  3. From node_modules/newrelic, copy newrelic.js into the root directory of your app.
  4. Configure agent via the newrelic.js file or via environment variable:

  5. Add require('newrelic'); as the first line of your app's main module.
  6. Optional: For additional Node.js runtime-level statistics, ensure the @newrelic/native-metrics package is installed.
  7. Generate some traffic, then wait a few minutes for data to appear in the New Relic APM UI.

You can further customize your agent behavior via newrelic.js or an environment variable. To keep the agent configuration separate from your app, edit the NEW_RELIC_HOME environmental variable.

Keep your Node.js agent up-to-date

To ensure that you have the most up-to-date version of New Relic, refer to the Node.js release notes. When applicable, the release notes include a download link with instructions on how to update the Node.js agent.


After you update the agent, generate some traffic and wait a few minutes. If no data appears in the New Relic UI, see the troubleshooting procedures.

View installation video

Before installing New Relic, you may want to view the video tutorials at New Relic University:

[video link] For a Node.js installation tutorial, watch this video (approximately 4 minutes). For more information, check out New Relic University’s tutorial Installing the Node agent. Or, go directly to the full online course: Get started with APM.

For more help

Recommendations for learning more: