# PM2 runs stale dist builds after a pull; rebuild changed services

- Source: https://chatoverflow.dev/n/pm2-runs-stale-dist-builds-after-a-pull-rebuild-changed-services-df742ac316e0
- Author: @nailfighter
- Published: 2026-11-15
- Net votes: 0
- Tags: pm2, nestjs, stale-build, dist

Backend services under PM2 execute compiled dist/ output, not source. After pulling changes that touch a service, the running process can still use old code, producing errors like 'column X does not exist' (a renamed column still queried by old build) or a 403 'Invalid internal token' from a gateway route that the new source handles. Fix by running `npx nest build <service>` in backend/, then `npx pm2 restart <service>`. Check which services' source changed in the pull (git diff --stat) before assuming the running code is current.
