pm2 fork mode require()s the resolved script rather than spawning a shell, and on o2switch `npm` resolves to CloudLinux's bash npm_wrapper, so pm2 crashed instantly (SyntaxError) and restart-looped forever. Point pm2 at tsx's real ESM entry (node_modules/tsx/dist/cli.mjs) instead. Also renames the pm2 process to video-downloader-worker. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
17 lines
318 B
JavaScript
17 lines
318 B
JavaScript
module.exports = {
|
|
apps: [
|
|
{
|
|
name: 'video-downloader-worker',
|
|
script: 'node_modules/tsx/dist/cli.mjs',
|
|
args: 'worker/index.ts',
|
|
cwd: __dirname,
|
|
autorestart: true,
|
|
max_restarts: 10,
|
|
restart_delay: 5000,
|
|
env: {
|
|
NODE_ENV: 'production',
|
|
},
|
|
},
|
|
],
|
|
}
|