Skip to content

Could not find "pm2.exe" service after 10 attempts #104

@mdodge-ecgrow

Description

@mdodge-ecgrow

We are working on setting up a new internal (virtual) Windows web server. I have everything else working well except when the machine is rebooted, pm2 does not auto-start. So thats how I ended up here. I copied the extracted "pm2-installer-main" folder to a folder on my c drive. Then I opened up a admin priveleged CMD and moved to that directory. I attempted "npm run setup" first and got "Could not find "pm2.exe" service after 10 attempts". Then I tried "npm run configure" followed by "npm run configure-policy". Those both appeared to run successfully. Then I attemped "npm run setup" again and got the same error.

Here is the full log if it helps:

C:\web\pm2\pm2-installer-main>npm run setup

> pm2-installer@3.4.3 setup
> node ./src/tools/script-for-os.js


> pm2-installer@3.4.3 setup:windows
> PowerShell -NoProfile -ExecutionPolicy Bypass src\windows\setup.ps1

=== Setup ===
=== Checking Script Privileges ===
Script is running as administrator.
=== Checking Script Privileges Complete ===
=== Checking npm Configuration ===
Global npm prefix location appears valid: C:\ProgramData\npm\npm
Global npm cache location appears valid: C:\ProgramData\npm\npm-cache
=== Checking npm Configuration Complete ===
=== Install Packages ===
Running on: 8/1/2025, pm2-installer 3.4.3 with node v22.16.0 and npm 11.4.1 on win32-10.0.17763.
Using:
 pm2@5.2.2
 @jessety/pm2-logrotate@2.7.1
 node-windows@1.0.0-beta.6
Checking connectivity to the npm registry..
Received unexpected response from registry.npmjs.org: {}
Cannot connect to the npm registry, and no offline bundle was found. Attempting install anyway..

added 161 packages in 5s

added 181 packages in 4s

added 5 packages in 828ms
Linking node-windows..

added 141 packages, and changed 3 packages in 8s
Unblocking script at C:\ProgramData\npm\npm\pm2.ps1..
=== Install Packages Complete: took 18 seconds ===
=== Creating Service ===
Determining pm2 installation directory..
Determining Local Service user name ("S-1-5-19")..
Configuration:
  PM2_HOME:              C:\ProgramData\pm2\home
  PM2_SERVICE_DIRECTORY: C:\ProgramData\pm2\service
  PM2_INSTALL_DIRECTORY: C:\ProgramData\npm\npm\node_modules\pm2
  Service User:          NT AUTHORITY\LOCAL SERVICE

Attempting to create "C:\ProgramData\pm2\home"
Directory "C:\ProgramData\pm2\home" already exists, no need to create it.
Attempting to create "C:\ProgramData\pm2\service"
Directory "C:\ProgramData\pm2\service" already exists, no need to create it.
Copying service files from ".\src\windows\service\" to "C:\ProgramData\pm2\service"..
Copying files complete.
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\home".
Successfully set permissions on "C:\ProgramData\pm2\home".
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\service".
Successfully set permissions on "C:\ProgramData\pm2\service".
Running Node service install script..
service-management\install Installing
Installing service "PM2" at "C:\ProgramData\pm2\service"
Already installed.
service-management\install Complete
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\home".
Successfully set permissions on "C:\ProgramData\pm2\home".
Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\service".
Successfully set permissions on "C:\ProgramData\pm2\service".
Updating "pm2.exe" service to run as "NT AUTHORITY\LocalService"
Attempt #2 to locate "pm2.exe" service..
Attempt #3 to locate "pm2.exe" service..
Attempt #4 to locate "pm2.exe" service..
Attempt #5 to locate "pm2.exe" service..
Attempt #6 to locate "pm2.exe" service..
Attempt #7 to locate "pm2.exe" service..
Attempt #8 to locate "pm2.exe" service..
Attempt #9 to locate "pm2.exe" service..
Attempt #10 to locate "pm2.exe" service..
Could not find "pm2.exe" service after 10 attempts.
At C:\web\pm2\pm2-installer-main\src\windows\setup-service.ps1:124 char:5
+     throw "Could not find `"$name`" service after $maxAttempts attemp ...

If it helps at all, I searched the server and found pm2.exe here: C:\ProgramData\pm2\service\daemon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions