pm2-installer icon indicating copy to clipboard operation
pm2-installer copied to clipboard

Error on Install

Open johntom opened this issue 3 years ago • 7 comments

Description Followed instructions using Poershell admin mode nvm use node 14.16.1 npm version 6.14.12

Steps to Reproduce

  1. npm run configure
  2. npm run setup

Environment [Execute npm run info and paste the result here]

[email protected] info C:\etc\pm2-installer-main node ./src/bundle-info/current.js

Running on: 5/14/2021, pm2-installer 3.1.6 with node v14.16.1 and npm 6.14.12 on win32-10.0.17763.

Error

[email protected] setup C:\etc\pm2-installer-main node ./src/tools/script-for-os.js

[email protected] setup:windows C:\etc\pm2-installer-main 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: 5/13/2021, pm2-installer 3.1.6 with node v14.16.1 and npm 6.14.12 on win32-10.0.17763. Using: [email protected] [email protected] [email protected] Checking connectivity to the npm registry.. Successfully connected to registry.npmjs.org. Installing packages.. C:\ProgramData\npm\npm\pm2 -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2 C:\ProgramData\npm\npm\pm2-dev -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2-dev C:\ProgramData\npm\npm\pm2-docker -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2-docker C:\ProgramData\npm\npm\pm2-runtime -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2-runtime

  • [email protected] updated 1 package in 6.15s
  • [email protected] updated 1 package in 5.406s
  • [email protected] added 4 packages from 7 contributors and updated 1 package in 0.789s Installing packages took 15 seconds. Linking node-windows.. C:\etc\pm2-installer-main\node_modules\node-windows -> C:\ProgramData\npm\npm\node_modules\node-windows Unblocking script at C:\ProgramData\npm\npm\pm2.ps1.. === Install Packages Complete: took 19 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" Found "pm2.exe" service: State: Stopped Status: OK Started: False Start Mode: Auto Service Type: Own Process Start Name: NT AUTHORITY\LocalService Changing service user account.. Starting service.. Could not start service: Access Denied At C:\etc\pm2-installer-main\src\windows\setup-service.ps1:182 char:5

  • throw "Could not start service: $message"
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (Could not start service: Access Denied:String) [], RuntimeException
    • FullyQualifiedErrorId : Could not start service: Access Denied

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] setup:windows: PowerShell -NoProfile -ExecutionPolicy Bypass src\windows\setup.ps1 npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] setup:windows script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\ProgramData\npm\npm-cache_logs\2021-05-14T03_55_57_553Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] setup: node ./src/tools/script-for-os.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] setup script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\ProgramData\npm\npm-cache_logs\2021-05-14T03_55_57_599Z-debug.log PS C:\etc\pm2-installer-main>

johntom avatar May 14 '21 04:05 johntom

I got the same error, but PM2 still showed in Services for me. I then went to it and started it manually. I also changed Log On to Local System Account.

xinthose avatar Jul 20 '21 15:07 xinthose

for me, it's a different error. I use windows NVM too but with node v16. I had pm2 installed globally with npm before running this. maybe that's related too.

λ npm run setup

> [email protected] setup
> node ./src/tools/script-for-os.js


> [email protected] 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:\Program Files\nodejs
Global npm cache location appears valid: C:\Users\Babak\AppData\Local\npm-cache
=== Checking npm Configuration Complete ===
=== Install Packages ===
Running on: 8/9/2021, pm2-installer 3.2.2 with node v16.6.0 and npm 7.19.1 on win32-10.0.19043.
Using:
 [email protected]
 @jessety/[email protected]
 [email protected]
Checking connectivity to the npm registry..
Successfully connected to registry.npmjs.org.
Installing packages..

changed 180 packages in 25s

added 206 packages in 14s

added 5 packages in 4s
Installing packages took 47 seconds.
Linking node-windows..
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/@jessety%2feslint-config failed: cache mode is 'only-if-cached' but no cached response is available.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Babak\AppData\Local\npm-cache\_logs\2021-08-09T16_52_53_099Z-debug.log
Unblocking script at C:\Program Files\nodejs\pm2.ps1..
=== Install Packages Complete: took 70 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:\Program Files\nodejs\node_modules\pm2
  Service User:          NT AUTHORITY\LOCAL SERVICE

Attempting to create "C:\ProgramData\pm2\home"
Directory "C:\ProgramData\pm2\home" does not exist, creating it..
Attempting to create "C:\ProgramData\pm2\service"
Directory "C:\ProgramData\pm2\service" does not exist, creating 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
Could not load "node-windows", likely because it has already been uninstalled.
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:\Users\Babak\Desktop\pm2-installer-main\src\windows\setup-service.ps1:124 char:5
+     throw "Could not find `"$name`" service after $maxAttempts attemp ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Could not find ...er 10 attempts.:String) [], RuntimeException
    + FullyQualifiedErrorId : Could not find "pm2.exe" service after 10 attempts.

unicornist avatar Aug 09 '21 17:08 unicornist

Hi !

I have exactly the same problem as above : "Could not find "pm2.exe" service after 10 attempts." I am also using node v16

@unicornist Did you manage to solve it ?

Moulisse avatar Aug 23 '21 08:08 Moulisse

@unicornist and @Moulisse I'm also now getting this error. Any tips?

nathanielrindlaub avatar Aug 30 '21 23:08 nathanielrindlaub

If I can't get it to work on some PC's, I end up using a scheduled task set to run a batch script whether user is logged on or not.

Batch script:

@echo off

pm2 resurrect

exit 0

xinthose avatar Aug 31 '21 17:08 xinthose

The same issue as @unicornist is there fix or how to solve this issue @jessety

hosvfx avatar Jan 12 '22 20:01 hosvfx

@unicornist @Moulisse @hosvfx @nathanielrindlaub

I've run into this issue when trying to install from a non-user folder (i.e., directly on the C: drive). Running npm run remove and npm run deconfigure, then re-extracting the zip to C:/Users/before going through the installation has fixed it for me.

w-renk avatar May 23 '23 13:05 w-renk