I'm aware a few similar questions have been asked before - mainly here. However, whatever I try to do I cannot get this to work. Screenshot of the issue below. This happens when I attempt to run pm2 start api
.
My ecosystem.config.js
is:
const nodeServer = (role, debugPort) => ({
name: role,
script: 'server/server.js',
watch: role == 'api' ? ['client', 'server'] : ['server'],
ignore_watch: ['node_modules'],
max_memory_restart: '4G',
node_args: `--inspect=${debugPort}`,
env: {
NODE_OPTIONS: '--max-old-space-size=4096',
NODE_ENV: 'development',
SERVER_ROLE: role,
},
env_production: {
NODE_ENV: 'production'
}
})
module.exports = {
apps: [
nodeServer('api', 9229),
nodeServer('task', 9228),
nodeServer('scheduler', 9227),
]
}
PM2 is installed globally on my system running 5.1.0 (which I believe is the current latest). Node version is 14.13.0. I get the same error if I try on node versions 10 & 12. I'm really struggling to figure this one out.