How to fix an issue that code changes are not reflecting in PM2?

2.7k Views Asked by At

In my PM2 instance running on Windows server having 4 cores CPU and that many clusters/instances, file changes are caught and servers get restarted but the changes do not get reflected. Instead it continues to show the old updates/features.

But when I tried doing the following it starts reflecting the new updates.

$ pm2 stop all
$ pm2 kill 
$ pm2 start... (one by one)

This does not happen always but happens sometime only. How to fix this?

1

There are 1 best solutions below

3
ArpanDev7 On

I've faced this problem in AWS deployment. Then I come up with a solution after long research and this worked for me as a charm.

After git pull just stop your server and then start it. After that

  1. pm2 start index.js
  2. pm2 reload index

Now your changes are reflected.