0

When deploying from CI, as the user who started PM2, pm2 restart appname always results in [PM2][ERROR] Process or Namespace appname not found

whoami/who on deployment shows the correct user.

Tried switching users, as well as PM2's location: /usr/local/bin/pm2 restart appname results in the same process not found.

CI command:

script:
- pm2 restart appname

or:

deploy: 'ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_IP "pm2 restart appname"'
script:
- "eval $deploy"
Klav
  • 101
  • 1
  • 2
  • killing the processes via ssh, then ```pm2 restart ecosystem.config.js``` via CI, did the trick – Klav Jun 17 '21 at 23:55

2 Answers2

0

After the first "pm2 start appname" command run "pm2 save" it will synchronize the process with the previously saved list. In the CI script include "pm2 save" after restart example:

  • run: sudo pm2 restart appname
  • run: sudo pm2 save This worked for me, hope you've find your solution.
0

If you receive [PM2][ERROR] Script not found: /root/appname

Run the following first: pm2 start npm --name "appname" -- run "start:dev"

Then, see/run above from Debapriya Das, pm2 start appname and pm2 save

din n
  • 1