Simply Install the pm2 globally using this command sudo npm install -g pm2
sudo npm install -g pm2
this will resolve the issue