[Node] A valid PM2 installation is required

I was trying to install new relic in a server where I run npm apps that run with pm2 but when I try to install the npm-agent i get the following error “A valid PM2 installation is required”
I am using
pm2 v 5.0.4
node 12.18.3

Hello @zekiri.kumi

Were you using the Guided Installation to install the Node Agent on your application?

With the Guided Installation

@zekiri.kumi
It looks like the failure happened when the recipe was checking for the PM2 version, which basically runs a sudo pm2 -v command.
What environment are you running on, particularly what flavor of linux?
Also what shell are you seeing this in?