Install PM2
Copy and paste
Open a command prompt as Administrator
mkdir c:\etc\.pm2
setx PM2_HOME c:\etc\.pm2 /m
npm install pm2 -g
npm install -g pm2-windows-service
cd %USERPROFILE%\AppData\Roaming\npm\node_modules\pm2-windows-service
npm install
pm2-service-install -n PM2
Options when installing pm2-windows-service
> Perform environment setup (recommended)? Yes
> Set PM2_HOME? Yes
> PM2_HOME value (this path should be accessible to the service user and
should not contain any “user-context” variables [e.g. %APPDATA%]): c:\etc\.pm2\
> Set PM2_SERVICE_SCRIPTS (the list of start-up scripts for pm2)? No
> Set PM2_SERVICE_PM2_DIR (the location of the global pm2 to use with the service)? [recommended] Yes
> Specify the directory containing the pm2 version to be used by the
service C:\USERS\<USER>\APPDATA\ROAMING\NPM\node_modules\pm2\index.js
PM2 service installed and started.
log rotate
After setup the PM2
pm2 install pm2-logrotate