GithubHelp home page GithubHelp logo

jessety / pm2-installer Goto Github PK

View Code? Open in Web Editor NEW
461.0 14.0 41.0 273 KB

Install PM2 offline as a service on Windows or Linux. Mostly designed for Windows.

License: MIT License

JavaScript 36.03% Shell 5.52% PowerShell 57.82% Handlebars 0.62%
pm2 offline installer service windows-service pm2-service pm2-installer pm2-windows-service pm2-setup windows

pm2-installer's Introduction

pm2-installer

pm2-installer is designed to automate installation of pm2 as a service, particularly on Windows, even in environments without Internet access.

Windows Support

Unfortunately, PM2 has no built-in startup support for Windows. PM2's documentation recommends using either pm2-windows-service or pm2-windows-startup. However, both of these projects have some real drawbacks.

pm2-windows-startup adds an entry to the registry to start pm2 after user login. Because it does not create a service, PM2 will not be running until a user has logged into the user interface, and will halt when they log out. It has not been updated since 2015.

pm2-windows-service uses node-windows to create a service that runs pm2. This is a much better approach, but it hasn't been maintained since 2018, has outdated dependencies that cause crashes on setup, and currently fails to run properly on Node 14. It also runs the service as the the Local System user instead of Local Service.

This project creates its own Windows Service using the current version of node-windows and a series of PowerShell scripts inspired by this excellent gist by @maxfierke & @mauron85.

When running on Windows, pm2-installer will:

  • Configure npm to keep its global files in C:\ProgramData\npm, instead of keeping them in the current user's %APPDATA%
  • Install pm2 globally, using an offline cache if necessary
  • Create the C:\ProgramData\pm2 directory and set the PM2_HOME environmental variable at the machine level
  • Set permissions both the new npm and pm2 folders so that the Local Service user may access them
  • Leverage node-windows to install a new Windows service
  • Use PowerShell to configure the service to run as the Local Service user (due to node-windows#89)
  • Confirm the service is running properly
  • Install the pm2-logrotate module so that log files don't fill up the disk

After that, pm2 will be running in the background the Local Service user. It will persist across reboots and continue running regardless of which user is logged in. To add your app, run pm2 start app.js from an admin command line interface. Make sure to run pm2 save to serialize the process list.

Install

Download the latest version here.

Copy the entire pm2-installer directory onto the target machine, then run:

npm run setup

On Windows, the setup script assumes you have already configured npm to use prefix and cache directories in a location accessible to the Local Service user. If not, it will issue a warning and ask if you're sure you'd like to proceed. To set up npm automatically, run configure first:

npm run configure
npm run setup

That's it.

NOTE: Running npm install is not necessary, unless you're developing pm2-installer itself and want to lint the project.

Offline Install

pm2-installer is also designed to function without an internet connection. It does this by creating a cache on an internet-connected build machine, then installing from that cache when run on the offline deployment machine.

On an internet-connected build machine running the same OS as the deployment target, run the following:

npm run bundle

This will populate the cache in the project's directory with the resources required to install offline. Transfer the entire pm2-installer directory onto the deployment target, then run:

npm run setup

pm2-installer will check if it can contact the npm registry and install online if possible, or use the offline cache if not.

Windows Install

There are a couple additional challenges when installing on a fresh Windows machine. The npm global directory is not accessible to other users by default, which means the Local Service user will not be able to locate the pm2 executable. Additionally, if the machine's PowerShell execution policy is Undefined or Restricted, invoking pm2 in PowerShell will fail- even though the setup script unblocks pm2.ps1.

pm2-installer includes two additional scripts to automatically fix the above issues. Invoking npm run configure will create the C:\ProgramData\npm\, and set npm to use prefix and cache locations in that directory. Running npm run configure-policy checks the machine's PowerShell execution policy and if it is either undefined or Restricted, updates it to RemoteSigned.

Open an elevated terminal (e.g. right click and select "Run as Admin") and run the following commands first:

npm run configure
npm run configure-policy

Then, run npm run setup to install the pm2 service.

Additional context for Windows installations

  • The pm2 service runs as the Local Service user. To interact with pm2, you need to use an elevated terminal (e.g. right click and select "Run as Admin") before running any commands that interface with the service, e.g. pm2 list.
  • If you update node and npm, make sure to either manually re-configure your npm & node installations or run npm run configure again.
  • This project does not currently support nvm for windows. It requires a standard node installation.

Removal

To remove the pm2 service, run:

npm run remove

This will remove the service and completely uninstall pm2.

If you used the configure script on Windows to configure npm, you can revert those settings by running:

npm run deconfigure

License

MIT © Jesse Youngblood

pm2-installer's People

Contributors

beckyconning avatar bjalon avatar dependabot[bot] avatar fdawgs avatar jessety avatar punisher1 avatar semics-tech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pm2-installer's Issues

Service does not not start on "npm run setup"

Description

  • Service does not not start on "npm run setup"
  • setup script hangs forever

output:
D:\tmp\pm2-installer-main>npm run setup

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

[email protected] setup:windows D:\tmp\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: 18.5.2021, pm2-installer 3.1.6 with node v14.17.0 and npm 6.14.13 on win32-10.0.14393.
Using:
[email protected]
[email protected]

Checking connectivity to the npm registry..
Successfully connected to registry.npmjs.org.
Installing packages..
C:\ProgramData\npm\npm\pm2-docker -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2-docker
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-runtime -> C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2-runtime

[email protected] postinstall C:\ProgramData\npm\npm\node_modules\pm2-installer
echo 'Installing this package is not necessary. Run "npm run setup" to install pm2.'

'Installing this package is not necessary. Run "npm run setup" to install pm2.'

  • [email protected]
    updated 1 package in 4.577s
    Installing packages took 84 seconds.
    Linking node-windows..
  • [email protected]
    added 5 packages from 8 contributors in 2.176s
    D:\tmp\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 94 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-AUTORITÄT\Lokaler Dienst

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-AUTORITÄT\Lokaler Dienst" full permissions to "C:\ProgramData\pm2\home".
Successfully set permissions on "C:\ProgramData\pm2\home".
Attempting to grant "NT-AUTORITÄT\Lokaler Dienst" 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"
service-management\install Complete
Attempting to grant "NT-AUTORITÄT\Lokaler Dienst" full permissions to "C:\ProgramData\pm2\home".
Successfully set permissions on "C:\ProgramData\pm2\home".
Attempting to grant "NT-AUTORITÄT\Lokaler Dienst" 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: LocalSystem
Changing service user account..
Starting service..
State is now: Start Pending
State is now: Stopped
State is now: Stopped
State is now: Stopped

Steps to Reproduce
npm run configure
npm run configure-policy
npm run setup

Environment
D:\tmp\pm2-installer-main>npm run info

[email protected] info D:\tmp\pm2-installer-main
node ./src/bundle-info/current.js
Running on: 18.5.2021, pm2-installer 3.1.6 with node v14.17.0 and npm 6.14.13 on win32-10.0.14393.

Any ideas

Exception when service tries to connect to PM2

Description
When trying to start the service I get the following error in C:\ProgramData\pm2\service\service.log

Starting: 2022-04-22 08:13:44
2022-04-22 08:13:44: PM2_HOME:              C:\ProgramData\pm2\home
2022-04-22 08:13:44: PM2_SERVICE_DIRECTORY: C:\ProgramData\pm2\service
2022-04-22 08:13:44: PM2_INSTALL_DIRECTORY: C:\ProgramData\npm\npm\node_modules\pm2
2022-04-22 08:13:44: Working directory:     C:\ProgramData\pm2\service
2022-04-22 08:13:44: Running as user:       LOCAL SERVICE
2022-04-22 08:13:45: Starting pm2..
2022-04-22 08:13:45: 2022-04-22 08:13:45 service\index.js Uncaught Exception connect EPERM //./pipe/pub.sock Error: connect EPERM //./pipe/pub.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
2022-04-22 08:13:45: exit code 1

pm2 log

2022-04-22T08:09:59: PM2 log: ===============================================================================
2022-04-22T08:09:59: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
2022-04-22T08:09:59: PM2 log: Time                 : Fri Apr 22 2022 08:09:59 GMT+0200 (centraleuropeisk sommartid)
2022-04-22T08:09:59: PM2 log: PM2 version          : 5.2.0
2022-04-22T08:09:59: PM2 log: Node.js version      : 16.14.2
2022-04-22T08:09:59: PM2 log: Current arch         : x64
2022-04-22T08:09:59: PM2 log: PM2 home             : C:\ProgramData\pm2\home
2022-04-22T08:09:59: PM2 log: PM2 PID file         : C:\ProgramData\pm2\home\pm2.pid
2022-04-22T08:09:59: PM2 log: RPC socket file      : \\.\pipe\rpc.sock
2022-04-22T08:09:59: PM2 log: BUS socket file      : \\.\pipe\pub.sock
2022-04-22T08:09:59: PM2 log: Application log path : C:\ProgramData\pm2\home\logs
2022-04-22T08:09:59: PM2 log: Worker Interval      : 30000
2022-04-22T08:09:59: PM2 log: Process dump file    : C:\ProgramData\pm2\home\dump.pm2
2022-04-22T08:09:59: PM2 log: Concurrent actions   : 2
2022-04-22T08:09:59: PM2 log: SIGTERM timeout      : 1600
2022-04-22T08:09:59: PM2 log: ===============================================================================

Environment
Running on: 2022-04-22, pm2-installer 3.3.2 with node v16.14.2 and npm 8.5.0 on win32-10.0.17763.

Could not start service: Unknown Failure

I'm getting this error when running the setup script:

At <installation directory>\pm2-installer-master\src\windows\setup-service.ps1:182 char:5
+     throw "Could not start service: $message"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Could not start service: Unknown Failure:String) [], RuntimeException
    + FullyQualifiedErrorId : Could not start service: Unknown Failure

Need help on how to proceed. Thank you

pm2-logrotate bug with offline install

Description
I have installed pm2 and pm2-logrotate with pm2-installer

The issue is that the module pm2-logrotate is not restarted on laptop reboot

The problem happens when I install offline only. With an online install, pm2-logrotate is running fine after a reboot.

Steps to Reproduce

  1. Installing NodeJS with node-v12.20.1-x86.msi
  2. Download your project
  3. Open command prompt as admin and cd to your project
  4. Create the bundle on the same device with command npm run bundle
  5. Install offline with the following commands
    • npm run configure
    • npm run configure-policy
    • npm run setup
  6. pm2 list is showing pm2-logrotate module
  7. Reboot device
  8. pm2 list => module pm2-logrotate seems to have disapeared !

Environment
Running on: 2021-2-4, pm2-installer 3.1.1 with node v12.20.1 and npm 6.14.10 on win32-10.0.19041.

I can add some logs if you think it might be usefull. (logs about install run for example).

edit : I removed some steps so that the case is simpler to reproduce, but the problem is still persisting

Offline installation on Windows not working

Description
Offline installation on Windows 10 fails after/at step "Linking node-windows.." because the script want to fetch @jessety/eslint-config , which is not possible being offline.

Steps to Reproduce

  1. Install Node.js 16
  2. Download https://github.com/jessety/pm2-installer/archive/refs/tags/v3.1.6.zip
  3. Create offline bundle (extract, npm run bundle)
  4. Move directory to offline system - also with Node.js 16 installed
  5. Open cmd as Administrator
  6. npm run configure
  7. npm run configure-policy
  8. npm run setup
  9. => Error log.txt

Environment
Running on: 28.5.2021, pm2-installer 3.1.6 with node v16.2.0 and npm 7.13.0 on win32-10.0.17763.

Workaround

  1. On online machine: npm i -g @jessety/eslint-config editorconfig-checker inquirer nice-try write minimist [email protected] [email protected]
  2. Move C:\ProgramData\npm to offline system

Windows Event Log permissions issue

Description
I was able to install and launch a PM2 service just fine, but if I reboot the machine the PM2 service does not successfully start up again and I am getting the following error in C:\ProgramData\pm2\service\daemon\pm2.wrapper.log:

2021-08-20 10:14:06 - Failed to log event in Windows Event Log: Starting C:\Program Files\nodejs\node.exe  --harmony C:\ProgramData\npm\npm\node_modules\node-windows\lib\wrapper.js --file C:\ProgramData\pm2\service\index.js --scriptoptions= --log "PM2 wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst true; Reason:
Message:The source was not found, but some or all event logs could not be searched.  To create the source, you need permission to read all event logs to make sure that the new source name is unique.  Inaccessible logs: Security, State.
Stacktrace:   at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate)
   at System.Diagnostics.EventLog.SourceExists(String source, String machineName, Boolean wantToCreate)
   at System.Diagnostics.EventLogInternal.VerifyAndCreateSource(String sourceName, String currentMachineName)
   at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String message)
   at winsw.WrapperService.LogEvent(String message)
2021-08-20 10:14:06 - Starting C:\Program Files\nodejs\node.exe  --harmony C:\ProgramData\npm\npm\node_modules\node-windows\lib\wrapper.js --file C:\ProgramData\pm2\service\index.js --scriptoptions= --log "PM2 wrapper" --grow 0.25 --wait 1 --maxrestarts 3 --abortonerror n --stopparentfirst true

It looks to be a permissions issue with my Local Service account? Any help would be greatly appreciated!

Steps to Reproduce

  1. Run the following installation steps in order from an admin command prompt session:
npm run configure
npm run configure-policy
npm run setup
pm2 start app.js
pm2 save
  1. Reboot computer

Environment
Running on: 8/30/2021, pm2-installer 3.2.2 with node v14.17.5 and npm 6.14.14 on win32-10.0.19042.

pm2-windows-service fails on Node 14.0.0

The pm2-service-install script in @innomizetech/pm2-windows-service fails on Windows with Node 14.0.0. Everything functions as expected with Node 12.16.2.

The following was captured with pm2-installer 2.1.1, node v14.0.0, and npm 6.14.4 on win32-10.0.18363:

4/21/2020 11:46:59 AM:  Running pm2-service-install..
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (Use `node --trace-warnings ...` to show where the warning was created)
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
4/21/2020 11:47:00 AM:  (node:3948) Warning: Accessing non-existent property 'which' of module exports inside circular dependency

pm2 logs stopped after install of pm2-installer

I've been running pm2 without using pm2-installer, but the need has come up for me to use it for reboots. After installation, logs are no longer being output to the pm2 default log files. I can see my processes running just fine with normal memory and latency being displayed, just no new logs. I am thinking this is a redirect issue?

node processes get killed after session sign out

Whenever I sign out, my pm2 / node processes get killed. When signing in back again, the only one visible is the module @jessety/pm2-logrotate

Installation

I installed pm2-installer following the steps as Admin: npm run configure, npm run configure-policy, npm run setup.

What I've tried

  • The PM2 service was consistently stopped after logging out / in. I changed the service Log On to Local Service with the same effect. Then I changed to my user (Windows admin), which seems to keep the service running.
  • I granted permissions to the folder C:\ProgramData\pm2 to all users
  • Rebooted several times and re-run npm configure and setup several times

info: Running on: 21/03/2023, pm2-installer 3.4.3 with node v14.15.3 and npm 6.14.9 on win32-10.0.17763.

Thanks for any help!

pm2-installer broke running pm2 from non-admin account

Description
After installing the pm2-installer I was unable to start my services from the user account and had to use elevated command line [along with having to meddle with folder permissions] - it was inconvenient so I have uinstalled it "both [npm run remove" and "npm run deconfigure"] - I was able to run pm2 from user account again until system reboot - after it, it's back to giving me an error

Steps to Reproduce

  1. Install pm2-installer
  2. Find out it now only runs from elevated CMD
  3. Uninstall pm2-installer

Environment

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\wabak\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\wabak\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\wabak\AppData\Roaming\npm-cache_logs\2021-07-04T10_54_25_298Z-debug.log

The message when trying to run from non-admin cmd:
wabak

While running a nodejs application that is managed by pm2 I cannot manipulate a file on disk

Description
When I try to delete a file I get the error below. Seems to be a rights issue but not sure where the issue is coming from so I can address it.
Error: EPERM: operation not permitted, unlink my-file.txt

Steps to Reproduce

  1. while pm2 is managing my app I cannot delete(unlink) a from disk
  2. if I stop pm2 (pm2 stop "my-app") and just start it using "node my-app.js" then make the request the file deletes

Environment

npm bundle is not working on Windows Server 2012 R2

Description
Cannot install pm2-installer offline on a computer

Steps to Reproduce

  1. npm run bundle // computer with internet
  2. move folder to server without internet
  3. Open Node.js command prompt as administrator on server, cd to folder
  4. npm configure, npm configure-policy, npm run setup --> last command gives this error:
Folder\pm2-installer-3.3.1\src\windows\setup-packages.ps1 : Could not extract
offline bundle. Expand .\bundle.tar.gz or .\bundle.zip manually and run this
script again.
At C:\Users\septagehelp\Downloads\6.2.0.4\Copy Files to EleMech
Folder\pm2-installer-3.3.1\src\windows\setup.ps1:25 char:1
+ & .\src\windows\setup-packages.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep
   tion
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
   n,setup-packages.ps1
  1. I manually unzip bundle.zip and run npm run setup, I get the same error as above, so I delete bundle.zip and leave the folder, then I get the message:
Cannot connect to the npm registry, and no offline bundle was found. Attempting
install anyway..
  1. the installation fails, there is no internet on this computer

Environment

> [email protected] info
> node ./src/bundle-info/current.js

Running on: 1/25/2022, pm2-installer 3.3.1 with node v16.13.2 and npm 8.1.2 on w
in32-6.3.9600.

Create installation for different OS (offline)

As mentioned in the docs

On an internet-connected build machine running the same OS as the deployment target

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 running windows server 2019?

I haven't tried it yet but I see that it generates a package with the OS info

{
  "time": 1597504534.482,
  "date": "8/15/2020",
  "node": "v12.16.3",
  "npm": "6.14.7",
  "package": {
    "name": "pm2-installer",
    "version": "3.0.2"
  },
  "os": {
    "platform": "win32",
    "release": "10.0.18362"
  }
}

Thanks

Unrecognized token in source text - setup script

Description

There seems to be an error thrown by the console while running a setup script on Windows 7 Embedded.

Unrecognized token in source text.
At line:1 char:37
+ node src/tools/dependencies/echo.js  <<<< @jess
    + CategoryInfo          : ParserError: (:) []
    + FullyQualifiedErrorId : UnrecognizedToken

Solution

Apparently this line is causing an error:

$pm2_logrotate_package = "$(node src/tools/dependencies/echo.js @jessety/pm2-logrotate)"

which can be fixed by surrounding a package name with ':

$pm2_logrotate_package = "$(node src/tools/dependencies/echo.js '@jessety/pm2-logrotate')"

After this fix it works, however I didn't check on other environments so it's best to verify on different windows versions if adding quotes changes anything :) Please mind that the quotes need to be added in multiple files (ex. setup-packages, setup-logrotate)

Steps to Reproduce

  1. npm run serup

Environment

Running on: 5/4/2023, pm2-installer 3.4.3 with node v12.22.12 and npm 6.14.16 on win32-6.1.7601.

PS C:\Windows\system32> $PSVersionTab

Name                           Value
----                           -----
CLRVersion                     2.0.50
BuildVersion                   6.1.76
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0,
SerializationVersion           1.1.0.
PSRemotingProtocolVersion      2.1

pm2 logrotate got stuck with install

Description

Hello,

Some times in windows machine when logrotate is being installed the process got stuck here for ever. The original seup-logrotate.ps1 had this command pm2 install . --silent and the process got stuck after this log statement Installing pm2-logrotate locally in directory: C:\ProgramData\npm\npm\node_modules\@jessety\pm2-logrotate\.

I removed --slien flag and tried and now it printed [PM2] Spawning PM2 daemon with pm2_home=C:\ProgramData\pm2\home and got suck forever. It does not get stuck some times but it does sometimes.
Can you please help with this issue.

=== Creating Service Complete ===
=== Adding Log Rotation ===
Running in offline mode. Will not attempt to check npm registry connectivity.
Installing pm2-logrotate locally in directory: C:\ProgramData\npm\npm\node_modules\@jessety\pm2-logrotate\
[PM2] Spawning PM2 daemon with pm2_home=C:\ProgramData\pm2\home

Steps to Reproduce

  1. update seup-logrotate.ps1with this commandpm2 install .`
  2. Install PM2
  3. Process gets stuck in windows.

Environment

C:\WINDOWS\system32>npm -v
8.5.5

C:\WINDOWS\system32>node -v
v16.15.0

C:\WINDOWS\system32>pm2 -v
5.2.2

Error: connect EPERM //./pipe/rpc.sock

Description
Installation went well but I have an error when I try to see if pm2 is running with pm2 ps. I googled a little and some people talk about run as admin, which I already did. It seems to be related to the way we install pm2 on the machine. maybe you guys can help me on that part.

Steps to Reproduce

  1. install like stated in the README
  2. run pm2 ps

The Error

>pm2 ps
connect EPERM //./pipe/rpc.sock
[PM2] Spawning PM2 daemon with pm2_home=C:\ProgramData\pm2\home
events.js:287
      throw er; // Unhandled 'error' event
      ^

Error: connect EPERM //./pipe/rpc.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
Emitted 'error' event on ReqSocket instance at:
    at Socket.<anonymous> (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\sock.js:201:49)
    at Socket.emit (events.js:310:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'EPERM',
  code: 'EPERM',
  syscall: 'connect',
  address: '//./pipe/rpc.sock'
}

Environment

Running on: 9/11/2020, pm2-installer 3.0.2 with node v12.16.3 and npm 6.14.4 on win32-10.0.19042.

I ended with that on my global package list.

>npm list --depth=0 -g
C:\ProgramData\npm\npm
+-- [email protected]
+-- [email protected]
`-- [email protected]

PM2 couldn't run the app and the app ends up in "errored" status

Description
PM2 couldn't run the app and the app ends up in "errored" status

Steps to Reproduce

  1. Installed Node.js LTS 64 bit version on Windows Server 2012 R2
  2. Downloaded latest PM2-installer
  3. Ran following in order
    npm run configure
    npm run configure-policy
    npm run setup
  4. Ran server with node index.js Everything runs fine.
  5. Ran server with pm2 start index.js. The server starts in "errored" status. Logfile is empty
  6. however I noticed the following error in service.log in C:\ProgramData\pm2\service
2021-03-23T23:13:56: PM2 log: App [server-plugin:0] starting in -fork mode-
2021-03-23T23:13:56: PM2 log: App [server-plugin:0] online
ERROR: 2021-03-23T23:13:56: PM2 error: Error: spawn node ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
3/23/2021, 11:13:56 PM: default/server-plugin@N/A - start - MANUAL
ERROR: 2021-03-23T23:13:56: PM2 error: Cancelling versioning data parsing

Environment

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

Running on: 3/23/2021, pm2-installer 3.1.4 with node v14.16.0 and npm 6.14.11 on win32-6.3.9600.

Allow a custom service name and description

Is your feature request related to a problem? Please describe.
We would like to name the service something other than PM2 to allow our clients to understand which service is ours. We would also like to give a custom description for the same reason.

Describe the solution you'd like
A command line level argument or environment file that can be configured before installation to allow a custom name and/or description to the service.

Additional context
If there already is a way to do this, please add that to the readme file.

pm2-logrotate start failed when system startup

Description
pm2-logrotate it work well when first install. But restart system after pm2-logrotate start failed
Steps to Reproduce

  1. npm run setup
  2. restart windows system
  3. pm2 list
    pm2 list result
┌─────┬───────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name                  │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem
     │ user     │ watching │
├─────┼───────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1   │ neteae music proxy    │ default     │ 0.25.3  │ fork    │ 8188     │ 39s    │ 0    │ online    │ 0%       │ 32.7mb   │ myfreax  │ disabled │
└─────┴───────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬───────────────────────────────────────┬────────────────────┬───────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module                                │ version            │ pid   │ status   │ ↺    │ cpu      │ mem      │ user     │
├────┼───────────────────────────────────────┼────────────────────┼───────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 0  │ pm2-logrotate                         │ 2.7.0              │ N/A   │ errored  │ 0    │ 0%       │ 0b       │ LOC… │
└────┴───────────────────────────────────────┴────────────────────┴───────┴──────────┴──────┴──────────┴──────────┴──────────┘

Environment

> [email protected] info C:\Users\myfreax\Downloads\pm2-installer-main
> node ./src/bundle-info/current.js

Running on: 2021/4/19, pm2-installer 3.1.5 with node v14.16.1 and npm 6.14.12 on win32-10.0.19042.

I try check pm2-logrotate log, But log file have no any content. The log file is 0 Kb

pm2 logs  pm2-logrotate

result

[TAILING] Tailing last 15 lines for [pm2-logrotate] process (change the value with --lines option)
C:\ProgramData\pm2\home\logs\pm2-logrotate-out.log last 15 lines:
C:\ProgramData\pm2\home\logs\pm2-logrotate-error.log last 15 lines:

Not building

Description
A clear and concise description of what the bug is.

Copied folder from zip : "pm2-installer-main"
Ran : npm run bundle & npm run setup. Also ran : npm i to see if that was needed same result!
script-for-os is intended for use from an npm script only

Environment
[Execute npm run info and paste the result here]
Running on: 03/02/2021, pm2-installer 3.1.2 with node v15.5.0 and npm 7.3.0 on win32-10.0.19042.
image

Windows Offline installation Error

Description
When trying to install offline I'm getting below error.

Steps to Reproduce
Could not find "pm2.exe" service after 10 attempts.
At C:\Users\dev\Documents\pm2-installer\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.

Environment

[email protected] info
node ./src/bundle-info/current.js

Running on: 2/3/2022, pm2-installer 3.3.1 with node v16.13.2 and npm 8.1.2 on win32-10.0.17763.

Error caught while calling pidusage | TypeError: One of the pids provided is invalid

Description

I seem to be unable to use this daemon. When I try to run my Node app with it, it never runs and pm2 logs gives the following

PM2      | Error caught while calling pidusage
PM2      | TypeError: One of the pids provided is invalid
PM2      |     at get (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pidusage\lib\stats.js:78:23)
PM2      |     at pidusage (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pidusage\index.js:30:5)
PM2      |     at Object.getMonitorData (C:\ProgramData\npm\npm\node_modules\pm2\lib\God\ActionMethods.js:60:5)
PM2      |     at tasks (C:\ProgramData\npm\npm\node_modules\pm2\lib\Worker.js:150:9)
PM2      |     at Domain.<anonymous> (C:\ProgramData\npm\npm\node_modules\pm2\lib\Worker.js:193:7)
PM2      |     at Domain.run (node:domain:389:15)
PM2      |     at Timeout.wrappedTasks [as _onTimeout] (C:\ProgramData\npm\npm\node_modules\pm2\lib\Worker.js:192:7)
PM2      |     at listOnTimeout (node:internal/timers:564:17)
PM2      |     at process.processTimers (node:internal/timers:507:7)
PM2      | Error caught while calling pidusage
PM2      | TypeError: One of the pids provided is invalid
PM2      |     at get (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pidusage\lib\stats.js:78:23)
PM2      |     at pidusage (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pidusage\index.js:30:5)
PM2      |     at getMonitorData (C:\ProgramData\npm\npm\node_modules\pm2\lib\God\ActionMethods.js:60:5)
PM2      |     at Server.onmessage (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pm2-axon-rpc\lib\server.js:104:6)
PM2      |     at RepSocket.emit (node:events:513:28)
PM2      |     at RepSocket.emit (node:domain:489:12)
PM2      |     at Parser.<anonymous> (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\pm2-axon\lib\sockets\rep.js:51:15)
PM2      |     at Parser.emit (node:events:513:28)
PM2      |     at Parser.emit (node:domain:489:12)
PM2      |     at Parser._write (C:\ProgramData\npm\npm\node_modules\pm2\node_modules\amp\lib\stream.js:91:16)

Steps to Reproduce

  1. Fresh install of pm2-installer
  2. Navigate to apps folder
  3. Execute the following: pm2 start npm --name SnailyCADv4 -- run start

Environment

npm run info for some reason throws the error, Missing script: "info"
Didn't realize it had to be run in the repo folder. Output:

> [email protected] info
> node ./src/bundle-info/current.js

Running on: 2/13/2023, pm2-installer 3.4.3 with node v18.13.0 and npm 9.4.2 on win32-10.0.20348.

How to run different apps as different users?

Sorry for opening a feature request, I cannot find a better place to ask.

I'd like to be able to run pm2 as a particular user, that's because I need to access UNC paths using node. Is it possibile to do that?

In my dreams pm2 running as Local Service with different apps running by different users, keeping the pm2 service accessible and controllable by multiple admin users (or a group of users). But I think this will remain a dream, right?

Thanks

Publish in npm repository

This is an excellent solution. Unfortunately our business requirement is such that we can only used published npm packages. Would it be possible to publish it over npm packages?

Error while npm run config

Description
I am having a cache error while installing on a production system without internet

Steps to Reproduce

  1. on my dev computer
  • npm run bundle
  1. I zipped the entire repo and copied to my prod computer, then unzipped...
  2. In an admin powershell terminal
  • npm run configure
  • npm run setup

I'm getting the following install log :

> [email protected] setup C:\users\xxx\Desktop\pm2-installer
> node ./src/tools/script-for-os.js


> [email protected] setup:windows C:\users\xxx\Desktop\pm2-installer
> PowerShell -NoProfile -ExecutionPolicy Bypass src\windows\setup.ps1

=== Setup ===
=== 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: 9/9/2020, pm2-installer 3.0.2 with node v10.19.0 and npm 6.13.4 on win32-10.0.16299.
Using:
 [email protected]
 [email protected]
 [email protected]
Checking connectivity to the npm registry..
Could not connect to registry.npmjs.org: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
Cannot connect to the npm registry. Checking for offline bundle..
Cache tar bundle detected. Decompressing..
Decompressing .\bundle.tar.gz took 3 seconds.
Bundled on: 9/9/2020, pm2-installer 3.0.2 with node v10.19.0 and npm 6.13.4 on win32-10.0.17763.
WARNING: Bundle was created on win32-10.0.17763 but this is win32-10.0.16299.
v Offline install bundle appears valid.
Cache verified and compressed (C:\users\xxx\Desktop\pm2-installer\.npm_cache\_cacache):
Content verified: 378 (9515873 bytes)
Index entries: 576
Finished in 0.446s
Installing packages..
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/pm2 failed: cache mode is 'only-if-cached' but no cached response available.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\users\xxx\Desktop\pm2-installer\.npm_cache\_logs\2020-09-09T00_42_40_628Z-debug.log
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/pm2-logrotate failed: cache mode is 'only-if-cached' but no cached response available.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\users\xxx\Desktop\pm2-installer\.npm_cache\_logs\2020-09-09T00_42_41_337Z-debug.log
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/node-windows failed: cache mode is 'only-if-cached' but no cached response available.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\users\xxx\Desktop\pm2-installer\.npm_cache\_logs\2020-09-09T00_42_42_047Z-debug.log
Installing packages took 2 seconds.
Linking node-windows..
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/node-windows failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\ProgramData\npm\npm-cache\_logs\2020-09-09T00_42_42_772Z-debug.log
=== Install Packages Complete: took 9 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
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\xxx\Desktop\pm2-installer\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.

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\2020-09-09T00_42_53_870Z-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\2020-09-09T00_42_53_899Z-debug.log

Environment
Running on: 9/9/2020, pm2-installer 3.0.2 with node v10.19.0 and npm 6.13.4 on win32-10.0.16299.

Failed to set permissions on "C:\ProgramData\pm2\home"

Description

When trying to run the setup I get this output

Attempting to grant "NT AUTHORITY\LOCAL SERVICE" full permissions to "C:\ProgramData\pm2\home".
Failed to set permissions on "C:\ProgramData\pm2\home". Details: The 'Get-Acl' command was found in the module
'Microsoft.PowerShell.Security', but the module could not be loaded. For more information, run 'Import-Module
Microsoft.PowerShell.Security'.
At C:\Tools\pm2-installer-main\src\windows\setup-service.ps1:52 char:5
+     throw "Failed to set permissions on `"$Directory`". Details: $_"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Failed to set p...hell.Security'.:String) [], RuntimeException
    + FullyQualifiedErrorId : Failed to set permissions on "C:\ProgramData\pm2\home". Details: The 'Get-Acl' command w
   as found in the module 'Microsoft.PowerShell.Security', but the module could not be loaded. For more information,
  run 'Import-Module Microsoft.PowerShell.Security'.

I'm running PowerShell 7.3.4

Steps to Reproduce

  1. Admin: Terminal
  2. After running configure
  3. npm run setup

Environment

6/9/2023, pm2-installer 3.4.3 with node v18.14.2 and npm 9.6.4 on win32-10.0.22621.

Offline install: ENOTCACHED, Could not load "node-windows", Could not find "pm2.exe".

keep having issue installing offline.

1.request to https://registry......@jessety eslint-config failed cache mode is 'only-if-cached' but no cached response is available
2. Cloud not load "node-windows"
3.the console keep saying attempt to locate pm2.exe service, and it always failed after 10 attempts.
pm2 version 5.1.2
npm version 8.1.2
node version 16.13.1

have tried method in this post coreybutler/node-windows#57
npm link node-windows seems to be doing something, however since there's not external internet connectivity, it froze at a progress bar kind of message. saying
[ ] - idealTree:pm2-installer-main: sill idealTree buildDeps

Any help? I think it's because node-windows not working os it cannot create windows service?

user home dir operation not permitted

while i install pm2-installer success, i run my progress with an admin command line interface. i try to create a dir C:\Users\wowo\Documents\VideoCopilot, then i receive an error Error: EPERM: operation not permitted, mkdir 'C:\Users\wowo\Documents\VideoCopilot'.

so is this a bug ? or Window's security policy ?

thanks for any help

Node.js server stops running after logout

The server stops once the user logs out. However, the server runs when the PowerShell window, from where pm2 was run, is closed.
I am new to PM2 and PM2-installer, so it is possible that I might be missing something, but I have checked everything multiple times.

  1. A local system service pm2 is seen running
  2. I see folders C:\ProgramData\npm and C:\ProgramData\pm2
  3. I have run pm2 save before closing window and logging off.
    The operating system is Windows Server 2012 R2
    Any ideas, please!

pm2 start issue

OS => windows server 2019 ( any windows OS will give this same problem)

Step 1 => Formatted my computer. installed new OS.
Step 2 => Downloaded pm2-installer file. extract it and run the command.
everything working fine.

but when try to repeat this step on virtual box or vmware (any virtual machine )
pm2 start script failed (same OS used )

might be because of =>

pm2-service: 4/21/2023, 2:16:29 PM service\index.js Uncaught Exception connect EPERM //./pipe/pub.sock Error: connect EPERM //./pipe/pub.sock
at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
pm2-service: exit code 1

here are the whole error list =>

ERROR: 2023-04-21T14:11:41: PM2 error: Error: spawn node ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
ERROR: 2023-04-21T14:11:41: PM2 error: Error caught while calling pidusage
ERROR: 2023-04-21T14:11:41: PM2 error: TypeError: One of the pids provided is invalid
4/21/2023, 2:11:41 PM: default/index@N/A - start - MANUAL
4/21/2023, 2:11:41 PM: default/index@N/A - online - AUTOMATED
ERROR: 2023-04-21T14:11:44: PM2 error: Error caught while calling pidusage
ERROR: 2023-04-21T14:11:44: PM2 error: TypeError: One of the pids provided is invalid
ERROR: 2023-04-21T14:11:45: PM2 error: Error caught while calling pidusage
ERROR: 2023-04-21T14:11:45: PM2 error: TypeError: One of the pids provided is invalid
ERROR: 2023-04-21T14:12:06: PM2 error: Error caught while calling pidusage
ERROR: 2023-04-21T14:12:06: PM2 error: TypeError: One of the pids provided is invalid
ERROR: 2023-04-21T14:12:15: PM2 error: Error caught while calling pidusage
ERROR: 2023-04-21T14:12:15: PM2 error: TypeError: One of the pids provided is invalid
ERROR: 2023-04-21T14:12:36: PM2 error: Error caught while calling pidusage
ERROR: 2023-04-21T14:12:36: PM2 error: TypeError: One of the pids provided is invalid
ERROR: 2023-04-21T14:12:45: PM2 error: Error caught while calling pidusage
ERROR: 2023-04-21T14:12:45: PM2 error: TypeError: One of the pids provided is invalid
ERROR: 2023-04-21T14:12:52: PM2 error: Error caught while calling pidusage
ERROR: 2023-04-21T14:12:52: PM2 error: TypeError: One of the pids provided is invalid

[pm2-service-log.lo
pm2.err.log
pm2.out.log
pm2.wrapper.log
g](https://github.com/jessety/pm2-installer/files/11294153/pm2-service-log.log)

App shows as started on pm2 ls but it's frozen and doesn't get a PID.

Description

After installing pm2-installer following the instructions (npm run configure && npm run setup), I get an ENOENT error when installing pm2-logrotate (probably unrelated). However when I try to start my application, it shows as a process running on pm2 ls but the memory is 0B and the application doesn't start.

I tried removing pm2-installer and re-installing to no avail.

If I remove pm2-installer and install npm i -g pm2 and then start the app with pm2 start app.js then the app starts all good.

Steps to Reproduce

  1. Install pm2-installer
  2. launch app with pm2 start app.js
  3. check pm2 ls and see the app running but no PID and no memory usage.

Environment

Running on: 21/08/2023, pm2-installer 3.4.3 with node v18.17.1 and npm 9.6.7 on win32-10.0.22621.

During offline installation : pm2-logrotate: No such file or directory

Description

During the pm2 offline installation on Centos, pm2 is installed but with the following error :

WARNING: Bundle was created on linux-3.10.0-1160.59.1.el7.x86_64 but this is linux-3.10.0-1160.el7.x86_64.
npm ERR! code ENOTCACHED
npm ERR! request to https://registry.npmjs.org/pm2/-/pm2-5.2.0.tgz 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!     /opt/keos/aristote/pm2-installer-main/.npm_cache/_logs/2022-04-12T01_18_09_801Z-debug-0.log
./src/unix/setup.sh: line 51: cd: /usr/local/lib/node_modules/pm2-logrotate/: No such file or directory",

Steps to Reproduce

  1. On an online CentOS 7, I install node v16.14.1 / npm 8.5.0
  2. I download the main branch of pm2-installer
  3. I untar it, I launch npm run bundle
  4. I tar it and copy it to an identical oflline CentOS
  5. I run npm run setup

Environment

> [email protected] info
> node ./src/bundle-info/current.js

Running on: 4/11/2022, pm2-installer 3.3.1 with node v16.14.1 and npm 8.5.0 on linux-3.10.0-1160.el7.x86_64.

No permission to Set-Permissions

Description

It stop here and prompts the error as below:

The 'Save-Module' command was found in the module 'PowerShellGet', but the module could not be loaded.

Solution in https://stackoverflow.com/questions/40987109/the-save-module-command-was-found-in-the-module-powershellget-but-the-modul is not working.

But manually execute scripts in

$rule = New-Object System.Security.AccessControl.FileSystemAccessRule($User, "FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")
try {
$acl = Get-Acl -Path $Directory -ErrorAction Stop
# $acl.SetAccessRuleProtection($true, $false)
# $acl.Access | ForEach-Object { $acl.RemoveAccessRule($_) | Out-Null }
$acl.SetAccessRule($rule)
Set-Acl -Path $Directory -AclObject $acl -ErrorAction Stop
Write-Host "Successfully set permissions on `"$Directory`"."

And commentout these lines in the code, works.

Steps to Reproduce

  1. in win11
  2. install pm2 using pnpm
  3. clone and configue and setup in this repo

Environment

Running on: 2023/5/18, pm2-installer 3.4.3 with node v20.2.0 and npm 9.6.6 on win32-10.0.22621.

Could not find "pm2.exe"

@jessety I follow all the instructions to install this package and every time it give me this error below is there way to resolve this issue?

""Could not find "pm2.exe" service after 10 attempts.
At C:\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.

Can not use different name than pm2 for service

Description
Can not use different name than pm2 for service.
Following error appears at the end of installation process
Could not find "pm2.exe" service after 10 attempts.

Relevant code references
pm2-installer/src/windows/setup-service.ps1:332
Set-ServiceUser -name "pm2.exe" -username "NT AUTHORITY\LocalService" -pass ""

pm2-installer/src/windows/setup-service.ps1:335
Confirm-Service -name "pm2.exe"

pm2-installer/src/windows/service-management/install.js:29
name = name || process.env.PM2_SERVICE_NAME || 'PM2';

pm2-installer/src/windows/setup-service.ps1:332
Set-ServiceUser -name "pm2.exe" -username "NT AUTHORITY\LocalService" -pass ""

pm2-installer/src/windows/setup-service.ps1:335
Confirm-Service -name "pm2.exe"

NOTE:
installing services with PM2_SERVICE_NAME result in creation of
daemon\PM2_SERVICE_NAME.exe
instead
daemon\pm2.exe

but name "-" is trimmed from name, and maybe some other characters

Steps to Reproduce

  1. set PM2_SERVICE_NAME
  2. npm run configure
  3. npm run setup

Environment
any windows

Install Error

Description
Last step: npm run setup fails on a new windows machine

Steps to Reproduce

  1. npm run configure
  2. npm run configure-policy
  3. npm run setup

Environment
[Execute npm run info and paste the result here]
C:\pm2-installer-main>npm run info

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

Running on: 8/23/2021, pm2-installer 3.2.3 with node v14.17.5 and npm 6.14.14 on win32-10.0.14393.
2021-08-23T20_49_20_619Z-debug.log

Apps started according to pm2, but they are not running any service

Description

  • Apps started according to pm2, but they are not running any service
  • Trying to access the Web application in the Browser does lead into the website.
  • Also, there no logs that the apps started.
  • see the screenshot

pm2-apps

Steps to Reproduce

  1. have setup pm2-installer to create pm2 apps in Windows 10.
  2. have started apps with pm2 start ecosystem....

Environment

NPM as spawned child process does not work

Description

Running on Windows Server 2022, Node 14.21.3, Npm 6.14.18

This is more a question regarding the necessity of running pm2 as "Local Service" rather than a bug report.

An app spawned by pm2 runs properly. Pm2 says it runs as Administrator and everything works as expected. But then this app spawns npm via NodeJS child_process, npm does not work properly. The output is seen below. The culprit seems to be the fact that pm2 is started as "Local Service". When I change it to "Administrator" npm is spawned correctly by the app.
Maybe, on Windows, a child_process is spawned by the user that pm2 runs as and not the user my app runs as. On Linux this is not a problem.

Steps to Reproduce

  1. Install pm2 via pm2-installer as stated in the documentation.
  2. Create a js file or an app that spawns npm and start it via pm2
  3. The app will output something like "Error: EEXIST: file already exists, mkdir 'C:\Users\Administrator\AppData\Roaming\npm'"

If it helps I could provide a precise example.

Environment

Running on: 26.4.2023, pm2-installer 3.4.3 with node v14.21.3 and npm 6.14.18 on win32-10.0.20348.

Could not start service: Service Dependency Failure

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.

Potentially Dangerous PATH Variables C:\ProgramData\npm\npm : builtin\users

Description

Potentially Dangerous PATH Variables "C:\ProgramData\npm\npm : builtin\users" is reported.

Steps to Reproduce

We have followed all the instructions as mentioned in the below link. As part of this we have also run "npm run configure" command and running this has created "C:\ProgramData\npm" in the environment variables "Path". However this seems to have reported as a vulnerability when the run the scan in EC2 servers. My organisation is asking if we can remove this setting or to put provide a remediation. Please advise.

https://github.com/jessety/pm2-installer

image

Environment

Windows Server 2016
Node JS 16.13.1 (Windows)
[email protected]
[email protected]

Error on Install

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>

when do offline install I get -> error code ENOTCACHED ,error request to https://registry.npmjs.org/@jessety%2feslint-config failed.

Description
When to do offline install I get the error in the log below

Steps to Reproduce
1.npm run bundle on internet connect machine same window,npm,node version as offline machine
2.on offline machine run following commands
npm run configure
npm run configure-policy
npm run setup

Environment

[email protected] info
node ./src/bundle-info/current.js

Running on: 1/26/2022, pm2-installer 3.3.1 with node v16.13.2 and npm 8.1.2 on win32-10.0.14393.

Log
PS C:\Windows\system32> cd C:\pm2-installer-main
PS C:\pm2-installer-main> 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:\ProgramData\npm\npm
Global npm cache location appears valid: C:\ProgramData\npm\npm-cache
=== Checking npm Configuration Complete ===
=== Install Packages ===
Running on: 1/26/2022, pm2-installer 3.3.1 with node v16.13.2 and npm 8.1.2 on win32-10.0.14393.
Using:
[email protected]
@jessety/[email protected]
[email protected]
Checking connectivity to the npm registry..
Could not connect to registry.npmjs.org: getaddrinfo ENOTFOUND registry.npmjs.org
Cannot connect to the npm registry. Checking for offline bundle..
Cache zip bundle detected. Decompressing..
Decompressing .\bundle.zip took 25 seconds.
Bundled on: 1/26/2022, pm2-installer 3.3.1 with node v16.13.2 and npm 8.1.2 on win32-10.0.14393.
√ Offline install bundle appears valid.
Cache verified and compressed (C:\pm2-installer-main.npm_cache_cacache)
Content verified: 583 (18175114 bytes)
Index entries: 583
Finished in 18.309s
Installing packages..

changed 181 packages in 17s

changed 207 packages in 18s

changed 5 packages in 718ms
Installing packages took 38 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'
ched response is available.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\ProgramData\npm\npm-cache_logs\2022-01-26T10_07_22_921Z-debug.log
Unblocking script at C:\ProgramData\npm\npm\pm2.ps1..
=== Install Packages Complete: took 90 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
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..

Need documentation on how to convert an "ecosystem.config.js" file to JSON for this system

Is your feature request related to a problem? Please describe.
Yes. I have no idea and can't find instructions on how to either register or convert my ecosystem.config.js file

Describe the solution you'd like
I have an ecosystem.config.js file that works in development and Linux but have no idea where to put it and register it for pm2 service to use it.

Additional context
I have a working ecosystem.config.js file and don't know how to get it to work with the pm2 service.
https://pm2.keymetrics.io/docs/usage/application-declaration/

Here is what I have in my file:

module.exports = {
apps: [
{
name: "em-srv",
script: "/AppServer/mas-em-srv/server.js",
instances: "1",
exec_mode: "cluster",
instance_var: "INSTANCE_ID",
watch: false,
max_memory_restart: "2G",
autorestart: true,
wait_ready: true,
listen_timeout: 10000,
kill_timeout: 5000,
NODE_ENV: "development",
},
],
};

State is now: Stopped

After running this on windows server 2022 (including the configure options), all I get is: State is now: Stopped printing endlessly to the powershell window. I tried to manually start the PM2 process, but it won't start.

Setup not working on PowerShell 2.0 after version 3.2.0

Description
Trying to run the setup step in an old version of Powershell (2.0) fails after version 3.2.0. When using version 3.1.6, it works.

Apparently, the addition of the prefix "@jessety/" on this commit: a8e0b9f causes a parse error problem on this version of Powershell.

Steps to Reproduce

  1. Runs 'npm run setup' on Powershell 2.0
  2. PowerShell returns a parse error, as following:

npm run setup

[email protected] setup D:\magic\installer\pm2-installer-3.2.1
node ./src/tools/script-for-os.js

[email protected] setup:windows D:\magic\installer\pm2-installer-3.2.1
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 ===
Token não reconhecido no texto de origem.
Em D:\magic\installer\pm2-installer-3.2.1\src\windows\setup-packages.ps1:6 caractere:35

  • node src/tools/echo-dependency.js <<<< @jessety/pm2-logrotate
    • CategoryInfo : ParserError: (:) [], ParseException
    • FullyQualifiedErrorId : UnrecognizedToken

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

[email protected] info D:\magic\installer\pm2-installer-3.2.1
node ./src/bundle-info/current.js

Running on: 2021-11-22, pm2-installer 3.2.1 with node v12.22.7 and npm 6.14.15 on win32-6.1.7601.

PM2 service cannot be restarted after Node.js upgrade

Description
I have upgraded Node.js for Windows to latest current stable version (16.15.0), updated PM2 and the PM2 Windows Service cannot be restarted.

Steps to Reproduce

  1. I stopped PM2 Windows service that was running
  2. Upgraded Node.js to latest stable version using nvm for Windows, i followed this guide https://www.geeksforgeeks.org/how-to-update-node-js-and-npm-to-next-version/
  3. Updated npm npm install -g npm
  4. Updated pm2 npm install pm2 -g and then pm2 update
  5. Restarting the PM2 Windows service says that the service cannot be started, the Windows Event Viewer don't give further helpful details

Additional info
After i did the steps 1 to 4 i also did the removal procedure and deconfigure of pm2-installer and did it again the setup and configure, the service will be installed but then don't start, it says "State is now: Stopped" forever in a loop

Environment
Running on: 29/4/2022, pm2-installer 3.3.2 with node v16.15.0 and npm 8.8.0 on win32-10.0.17763.
Machine is Windows Server 2019 Standard.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.