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.
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:
- 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.
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.
View installation video
Before installing New Relic, you may want to view the video tutorials at New Relic University: