Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No able to run pm2 on Windows server 2012

Tags:

node.js

npm

pm2

I installed pm2 on Windows server 2012

npm install pm2 -g

I closed my PowerShell and opened it again.

When I try to run pm2 it fails with this error

> pm2 list

pm2 : The term 'pm2' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pm2 list
+ ~~~
    + CategoryInfo          : ObjectNotFound: (pm2:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I noticed PM2_HOME was not set, so I set it to my .pm2 in my home directory, but that didn't help

Any pointers?

What is interesting, is that I have it working on another account on the same machine.

like image 646
zabumba Avatar asked Nov 30 '22 09:11

zabumba


2 Answers

Had the same problem on one Windows 2012R2 server PM2 was working and the other one not. In the Environment there was no path to

C:\Users\USERNAME\AppData\Roaming\npm

After adding the path and a restart of the server PM2 was recognized in PowerShell and CMD.

There is no need to add PM2 path to the System variables.

enter image description here

like image 109
Yoruba Avatar answered Dec 04 '22 05:12

Yoruba


There is Bountysource fundraising to make PM2 compatible with Windows:

  • https://www.bountysource.com/teams/keymetricsio/fundraisers/600-pm2-windows-support

which means that currently it is not completely compatible.

See also this issue:

  • https://github.com/Unitech/pm2/issues/6

with this comment from Unitech:

PM2 is a production module, who should be mainly used on Linux servers. I haven't tried it on other platforms than Linux.

like image 35
rsp Avatar answered Dec 04 '22 05:12

rsp