无法在Windows Server 2012上运行pm2

时间:2017-01-26 11:37:39

标签: node.js npm pm2

我在Windows Server 2012上安装了pm2

npm install pm2 -g

我关闭了PowerShell并再次打开它。

当我尝试运行pm2时,它会因此错误而失败

> 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

我注意到PM2_HOME未设置,所以我将其设置为我的主目录中的.pm2,但这没有帮助

任何指针?

有趣的是,我在同一台机器上使用另一个帐户。

4 个答案:

答案 0 :(得分:2)

有Bountysource筹款使PM2与Windows兼容:

这意味着目前它并不完全兼容。

另见此问题:

来自Unitech的评论:

  

PM2是一个生产模块,应主要用于Linux服务器。我还没有在Linux以外的其他平台上试过它。

答案 1 :(得分:0)

在一台Windows 2012R2服务器PM2上存在相同的问题,而另一台则没有。 在环境中,没有通往

的路径

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

在添加路径并重新启动服务器后,PM2在PowerShell和CMD中被识别。

  

无需将PM2路径添加到系统变量。

enter image description here

答案 2 :(得分:0)

您好尝试过这两种方法,但都无法在窗口服务器2012R上解决。enter image description here

答案 3 :(得分:0)

只需在全局模式下安装pm2

npm install pm2 -g -s