cd /path/to/your/nodejs/app
pm2 stop app_name_or_id
app_name_or_id
with the name or ID of your app's process in PM2.git checkout main # or the branch you want to update git pull origin main # replace 'main' with your desired branch if needed
package.json
has been updated with new dependencies, you need to install them.npm install
npm run build # This command can vary depending on your app
pm2 restart app_name_or_id