Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Angular Universal Node.Js app and new relic problem



Node Agent Question Template

  • Please provide a permalink so our experts can see into the exact time and place as you:
    Cannot since it’s private repo.

  • What language agent version are you using? Any other relevant versions? (Node modules, etc.?)
    Angular 5, npm 5, NodeJS 8.11

  • If you are seeing an error message, paste in the error message you are seeing (text or screenshot):
    I get the below error message when run “npm run build:ssr && npm run serve:ssr”:
    module.exports = newrelic;

ReferenceError: newrelic is not defined
at Object. (/home/dist/server.js:220805:18)
at webpack_require (/home/dist/server.js:20:30)
at Object.module.exports (/home/dist/server.js:220754:16)
at webpack_require (/home/dist/server.js:20:30)
at /home/dist/server.js:63:18
at Object. (/home/dist/server.js:66:10)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

  • Describe what are you seeing? Describe how that differs from you were expecting to see?
    When I install newrelic with “npm install newrelic --save” it installs correctly. I then place “var newrelic = require(‘newrelic’);” line on top of my server.ts file which I runt it via nodejs “node server.js”.
    I get then the error message above

Could someone explain to me which file should I place require(‘newrelic’) line into my angular universal app ?



Hey @a.arikan! Thanks for posting on the community!

It looks like you tagged this post under express but mentioned that this is an angular app.

The Node agent is intended to instrument Node applications that are running server-side (i.e. Express, Hapi and Restify) and is not meant to instrument client-side code.

Can you elaborate on whether your app is making calls to a Node app running server-side? If your app is not, you may want to take a look at our Browser agent.