无法在 Windows Server 2012 上运行 pm2

zab*_*mba 4 node.js npm pm2

我安装pm2在 Windows Server 2012 上

npm install pm2 -g
Run Code Online (Sandbox Code Playgroud)

我关闭了我的 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
Run Code Online (Sandbox Code Playgroud)

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

任何指针?

有趣的是,我让它在同一台机器上的另一个帐户上工作。

Yor*_*uba 13

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

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

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

无需在系统变量中添加 PM2 路径。

在此处输入图片说明


rsp*_*rsp 3

有 Bountysource 筹款使 PM2 与 Windows 兼容:

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

另请参阅此问题:

Unitech 的评论如下:

PM2是一个生产模块,应该主要用在Linux服务器上。除了Linux之外,我还没有在其他平台上尝试过。