Our Node.js agent is publicly available on the Node Package Manager (npm) repository as well as on GitHub. You can use our launcher, or follow the instructions in this document to complete a basic Node.js agent installation.
Install the Node.js agent
Important
If you're using the agent in a Docker container, install the agent in each container.
To install the Node.js agent:
Create a New Relic account. Don't have one? Sign up for free! No credit card required.
Ensure you meet the system requirements. In particular, make sure you use a supported Node version.
Use the command
npm install newrelic --save
for each application you want to monitor.From
node_modules/newrelic
, copynewrelic.js
into the root directory of your app.Configure agent via the
newrelic.js
file or via environment variable:- Customize the
license_key
setting with your license key. - Customize the
app_name
setting with one or more meaningful app names.
- Customize the
Add
require('newrelic');
as the first line of your app's main module.Optional: For additional Node.js runtime-level statistics, ensure the
@newrelic/native-metrics
package is installed.Generate some traffic, then wait a few minutes for data to appear in the 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.
Troubleshooting
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.
For more help
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's and and documentation.