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.
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:
- Ensure you meet the system requirements. In particular, ensure you are using a supported version of Node.
- Use the command
npm install newrelic --savefor each application you want to monitor.
- From node_modules/newrelic, copy
newrelic.jsinto the root directory of your app.
require('newrelic');as the first line of your app's main module.
- Optional: For additional Node.js runtime-level statistics, ensure the
@newrelic/native-metricspackage is installed.