jessety / pm2-installer

Install PM2 offline as a service on Windows or Linux. Mostly designed for Windows.
MIT License
495 stars 50 forks source link

Could not start service: Service Dependency Failure #5

Closed danilodecanini closed 4 years ago

danilodecanini commented 4 years ago

When I execute npm run setup the script install everything with success but when its time to start the service, I got a message like:

Could not start service: Service Dependency Failure No C:\pm2-installer\src\windows\setup-service.ps1:182 caractere:5 throw could not start service: $message CategoryInfo : OperationStopped: (Could not start...endency Failure:String) [], RuntimeException FullyQualifiedErrorId : Could not start service: Service Dependency Failure

I tried to install with the rewrite service branch, but I got the same error message.

If I go to services.msc there is a service called PM2 but I got almost the same error that is in script.

My Local Service User is on the local administrators group I don't think that is something related to permission.

danilodecanini commented 4 years ago

Update: Workaround: I change manually the user that runs PM2 service, instead of NT AUTORITHY\LOCAL SERVICE I used the Local service user, Idk what is the difference between them but now the service is running

jessety commented 4 years ago

Thank you! This is great. I'd heard of this issue before, but was never able to replicate it.

What version of Node do you have installed? What version of Windows are you running, and what is your system's base language?

There's a small PowerShell script that prints out some information about the service included in the installer. Could you cd into the pm2-installer directory and run PowerShell -NoProfile -ExecutionPolicy Bypass .\src\windows\check-service.ps1? Thanks again.

danilodecanini commented 4 years ago

Hi, @jessety

Node version: v12.17.0 SO version: Windows Server 2016 Standard x64 Base language: Português Brasil

Output from PS: Confirm-Service -name "pm2.exe" Found "pm2.exe" service: State: Running Status: OK Started: True Start Mode: Auto Service Type: Own Process Start Name: NT AUTHORITY\LocalService

jessety commented 4 years ago

It seems like this is an issue for all Windows installations where the base language isn't English. Yikes. A fix is now live in the service-dependency-fix branch.

@danilodecanini Try it out! If it works for you I'll merge #6.

Thanks again!

danilodecanini commented 4 years ago

With this fix it works with success!

Thank you so much for this quick fix!

jessety commented 4 years ago

Thanks for reporting it! 🎉👍