Using pm2 on Windows

#1

I want to launch/manage node-red using pm2 on Windows 10.

I have closely followed the instruction on the running page and various online tutorials. The process doesn't seem to stay running.

Command #1

If I execute the command:

pm2 start 'C:\Users\Dustin Michels\AppData\Roaming\npm\node-red' -- -v

The process seems to immediately stop

[PM2] Spawning PM2 daemon with pm2_home=C:\Users\Dustin Michels\.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting C:\Users\Dustin Michels\AppData\Roaming\npm\node-red in fork_mode (1 instance)
[PM2] Done.
┌──────────┬────┬─────────┬──────┬───────┬─────────┬─────────┬────────┬─────┬────────┬────────────────┬──────────┐
│ App name │ id │ version │ mode │ pid   │ status  │ restart │ uptime │ cpu │ mem    │ user           │ watching │
├──────────┼────┼─────────┼──────┼───────┼─────────┼─────────┼────────┼─────┼────────┼────────────────┼──────────┤
│ node-red │ 0  │ N/A     │ fork │ 22708 │ stopped │ 1       │ 0      │ 0%  │ 0 B    │ Dustin Michels │ disabled │
└──────────┴────┴─────────┴──────┴───────┴─────────┴─────────┴────────┴─────┴────────┴────────────────┴──────────┘

Command #2

If I instead execute the command:
pm2 start 'C:\Users\Dustin Michels\AppData\Roaming\npm\node_modules\node-red\red.js' -- -v

Things look more promising. It says "status: online."

[PM2] Spawning PM2 daemon with pm2_home=C:\Users\Dustin Michels\.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting C:\Users\Dustin Michels\AppData\Roaming\npm\node_modules\node-red\red.js in fork_mode (1 instance)
[PM2] Done.
┌──────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬────────────────┬──────────┐
│ App name │ id │ version │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem       │ user           │ watching │
├──────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼────────────────┼──────────┤
│ red      │ 0  │ 0.19.5  │ fork │ 25916 │ online │ 0       │ 0s     │ 0%  │ 34.8 MB   │ Dustin Michels │ disabled │
└──────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴────────────────┴──────────┘

But it seems like the process still stops immediately after displaying this message.

If I type pm2 ls I see no processes, and pm2 show red returns "red doesn't exist."

0 Likes

#2

Try the command pm2 logs to see if there were any clue as to what failed.

0 Likes