Trying to setup pm2 to restart the next.js node app on reboot of the server according to Windows: Auto start PM2 and node apps
on reboot and running pm2 ls I get : anyone have any ideas?
C:\Users\snoruzi>pm2 ls
connect EPERM //./pipe/rpc.sock
[PM2] Spawning PM2 daemon with pm2_home=C:\Users\snoruzi\.pm2
node:events:368
throw er; // Unhandled 'error' event
^
Error: connect EPERM //./pipe/rpc.sock
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)
Emitted 'error' event on ReqSocket instance at:
at Socket.<anonymous> (C:\Users\snoruzi\AppData\Roaming\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\sock.js:201:49)
at Socket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4048,
code: 'EPERM',
syscall: 'connect',
address: '//./pipe/rpc.sock'
}
The app is started by running yarn pm2
which runs the file pm2.json - which tells pm2 where the entry point of the node application is
{
"apps": [
{
"name": "centra-website",
"script": "node_modules/next/dist/bin/next",
"args": "start",
"cwd": "./",
"instances": "max",
"exec_mode": "cluster"
}
]
}
Service seems to be added fine and the pathing to executable looks correct