pm2: command not found if used in jenkins

时间:2019-01-07 13:38:58

标签: jenkins continuous-integration continuous-deployment pm2

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!

1 个答案:

答案 0 :(得分:0)

问题似乎是jenkins无法访问pm2可执行文件,或者它使用的环境与cmd不同。

如果您在Windows上,则在为特定用户而非所有用户安装pm2时会发生这种情况。

您可以转到环境变量并将pm2的路径设置为系统路径变量,或者可以更改jenkins的运行用户。 为此

  

转到服务->属性->登录并设置用户名/密码,然后   重新启动jenkins服务。