PM2 throws error when started from task scheduler

111
November 07, 2019, at 00:20 AM

So, I have these node scripts I can easily start everytime I want, including after restarting my Windows 2012 Server, with pm2 resurrect. As I need them to automatically start and I didn't get pm2-startup to work, I made a simple bat file as follows:

@echo off
C:\Users\admin\Desktop\nodeproj\node_modules\.bin\pm2 resurrect

If I open this or manually start it from the task scheduler, it works well. However, when it's triggered by the task scheduler on startup (I set it to start independent of user log in and with a 2 minutes delay) I get the following error:

connect EPERM //./pipe/rpc.sock
[PM2] Spawning PM2 daemon with pm2_home=P:\.pm2
events.js:174
      throw er; // Unhandled 'error' event
      ^
Error: connect EPERM //./pipe/rpc.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)
Emitted 'error' event at:
    at Socket.<anonymous> (C:\Users\admin\Desktop\nodeproj\node_modules\pm2-ax
on\lib\sockets\sock.js:201:49)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

It won't let me execute any commands and I'll have to kill all the node processes with taskkill to start them again (which, as I said, can be done by using the same bat file which started it in the first place).

Any ideas? I've tried all sorts of configurations and despite lacking any errors in the task history, it doesn't work.

Thanks in advance.

READ ALSO
How to create an admin panel for Angular Universal project?

How to create an admin panel for Angular Universal project?

I currently have an Angular Universal project which works great, Due to SEO needs iv'e been asked to implement an admin panel to this project where they will be able to update text content on their own

86
class method TypeError &ldquo;Int object not callable&rdquo;

class method TypeError “Int object not callable”

TypeError: 'int' object is not callable

41
How do I communicate variables between methods in Python?

How do I communicate variables between methods in Python?

I am a beginnerI wrote some code that I'm now trying to organize into methods, but I don't understand at all how Python communicates between methods

49
Seeking explanation of the advantages of async with/for

Seeking explanation of the advantages of async with/for

I'm new to asyncioI came across AIOFiles (https://github

84