Installing RUM Agent

Hi,

I'm currently trying to setup the RUM agent on my application server using the "Package Managers" method.
I'm not a web developper and I know very few about NodeJS. But from what I can understand from the documentation, I suppose I need to create a JavaScript File (e.g elastic-rum-agent.js) containing the piece of code given in the procedure which is starting by :

import { init as initApm } from '@elastic/apm-rum'
const apm = initApm({
[...]

Unfortunatly, when I launch this code with the command "node elastic-rum-agent.js", I get an error like this :

/root/node_modules/elastic-rum-agent.js:1
import { init as initApm } from '@elastic/apm-rum'
^
SyntaxError: Unexpected token {

Do you please have any idea of what is it related to ?
Is this the right way to install the RUM agent by the "Package Managers" method ?

Thank you in advance for your help

Hi @Gaby,

Thanks for reaching out.
The Real User Monitoring (RUM) agent is meant to be used with JavaScript applications that run in browsers.

If you want to monitor a Node.js application you should use Elastic APM Node.js agent.

Let me know if you have more questions.

Cheers,
Hamid

Thank you for your response,
I think I have a bad understanding of the "Package Manager" method and I gonna try the script tag method which seems simpler

Thank you for your help