module.exports = {
apps: [
{
name: 'nextjs',
script: 'yarn',
args: 'start',
cwd: '/home/xxxxxxx/',
instances: 'max',
exec_mode: 'cluster',
autorestart: true,
cron_restart: '0 * * * *',
watch: false,
exp_backoff_restart_delay: 100,
env: {
NODE_ENV: 'production',
},
},
],
};

bu kodu kendinize göre düzenleyin. ecosystem.config.js vb bir isimle kaydedip pm2 start xxx.js olarak çağırıp test edin. Yüksek ihtimalle çözülecektir sorununuz.