我在 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 中被识别。
There is no need to add PM2 path to the System variables.
关于node.js - 无法在 Windows Server 2012 上运行 pm2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41872620/