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.

View installation video

Before installing New Relic, you may want to view the video tutorials available through New Relic University.

 

[video link] For a Node.js installation tutorial, watch this video (approximately 4 minutes). View more videos and tutorials at learn.newrelic.com.

Install the Node.js agent

As explained in this section, be sure to add require('newrelic'); as the first line of your app's main module.

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. Edit newrelic.js:

  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.

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.

Check your app's performance

Within a few minutes of installation, data should start appearing in the New Relic APM UI. If no data appears after waiting a few minutes, see the troubleshooting procedures.

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

For more help

Additional documentation resources include:

Join the discussion about Node.js monitoring in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.