I have a strange issue and looked at all the places but did not find any solution.
We are using pm2 and it works fine. I am able to start/stop/delete and do other things and it works fine.
I have also added the pm2 cmd in the shell script and it works perfectly fine there too, but the problem I am facing now is..when I try to run the pm2 cmd or even run the shell script via. jenkins, I get "pm2: command not found" error.
How do I get this resolved? Please help!
The issue seems to be that jenkins is not able to access the pm2 executable or it using different environment than the cmd.
If you are on windows then this occures when you installed the pm2 for specific user and not for all users.
You can go to environments variable and set path of pm2 into system path variable or you can change the user under which jenkins is running. For that
go to services -> properties -> log on and set username/ password and restart the jenkins service.