Open bwgjoseph opened 4 years ago
Hi @bwgjoseph,
That shouldn't be a problem. I've bundled pm2-installer
on Windows 10 Pro and deployed on both Server 2019 and Server 2016 without issue.
Prior to installation, pm2-installer
uses bundle.json
to check the current environment against the one it was bundled with and prints out warnings if anything doesn't match. Those warnings can be safely ignored if everything works, but they can be helpful for debugging if not.
Feel free to reach out if you have any problems!
Hey @jessety,
I have just tested on my local VM, and it seem to be working great except that I need to run the command npm run setup
as a administrator, otherwise, it won't work.
Exception calling "SetEnvironmentVariable" with "3" argument(s): "Requested registry access is not allowed."
At C:\Users\xxx\Desktop\pm2-installer-3.0.2\pm2-installer-3.0.2\src\windows\setup-service.ps1:13 char:3
+ [Environment]::SetEnvironmentVariable("PM2_HOME", $env:PM2_HOME, "M ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : SecurityException
I also noticed that pm2.exe
service is in stopped mode after I installed it (even after I have restarted my machine). Do I have to start it manually?
Where is pm2-logrotate
supposed to be installed to? I couldn't find it under C:\ProgramData\pm2\home\modules
What's the reason for the need to run command prompt as administrator before I can run pm2
command?
Hi @bwgjoseph,
PM2 stores all the information it needs to run (dump of running processes, logs, modules, process ID of the daemon, etc.) in its "home" folder. On *nix systems, this is normally ~/.pm2/
. When the pm2
process starts, it checks the environmental variables for PM2_HOME
. If set, it uses that value as its home folder instead.
Because the service runs as the LocalService
user on Windows, pm2-installer
needs to set the PM2_HOME
environmental variable at a machine level before starting the service. When interacting with PM2, the command line interface loads the service process PID from the home folder, so if thePM2_HOME
variable isn't the same for both LocalService
and the user interacting with it, the CLI will assume no daemon is running and attempt to spawn one itself. Setting ENV values for the current user doesn't require admin privileges, but setting them on a "machine" level for all users does.
[Environment]::SetEnvironmentVariable("PM2_HOME", "C:\ProgramData\pm2\home\", "Machine")
If the above command fails, the rest of the installation will fail. The service should be automatically started- it should have printed out information about this during the setup process. You are correct, the pm2-logrotate
module should be in $env:PM2_HOME\modules
. If you attempted an install without elevated permissions and then ran it again as an admin, it might have borked itself. I suggest running npm run remove
before npm run setup
again in an Admin PowerShell window. If that doesn't work, post the setup
output here and I should be able to get a better idea of what's going on.
I re-read the README and I realize the requirement for elevated permissions was definitely not clear, so thanks for bringing this up!
I tried to run npm run remove
but face this error. I ran in admin mode (cmd). After which I ran on powershell
and it seem alright (see log below)
This is log from running using cmd (admin mode)
This is log from running in powershell (admin mode). Partial logs only, the rest seem to be running fine. I guess this should be fine too?
After which I restart my machine, then I try to configure again, this time using powershell - admin mode
I waited for 5mins or so and the service didn't get started, so I killed the setup.
Screenshot of the service if it's helpful
So I tried to run npm run configure
then run npm run setup
again. The result seem to be the same, the service doesn't seem to be able to get started.
Let me know if you want me to try anything out.
As mentioned in the docs
I am wondering if it matters if it's on the same OS but different version? For example, I am downloading the offline package using
windows 10
and to deploy it onto a offline machine runningwindows server 2019
?I haven't tried it yet but I see that it generates a package with the OS info
Thanks