繁体   English   中英

无法在 Windows server 2012 上运行 pm2

[英]No able to run pm2 on Windows server 2012

我在 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 ,但这没有帮助

任何指针?

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

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

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

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

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

在此处输入图像描述

有 Bountysource 筹款使 PM2 与 Windows 兼容:

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

另请参阅此问题:

来自 Unitech 的评论:

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

只需在全局模式下安装 pm2

npm install pm2 -g -s

可以通过将 npm 的路径添加到 env 设置来解决该问题。 至少这对我有用。

这里如何解决它:

  1. 选择开始 > 所有程序 > Windows PowerShell 版本 > Windows PowerShell。
  2. 仅类型:Set-ExecutionPolicy Unrestricted

尝试再次执行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM