node.js - 无法在 Windows Server 2012 上运行 pm2

标签 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,但这没有帮助

有什么指点吗?

有趣的是,我让它在同一台计算机上的另一个帐户上运行。

最佳答案

在一台 Windows 2012R2 服务器上遇到同样的问题,PM2 可以工作,而另一台则不能。 在环境中没有路径

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

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

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

enter image description here

关于node.js - 无法在 Windows Server 2012 上运行 pm2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41872620/

相关文章:

javascript - 运行 packager 时 React Native 命名冲突错误,由 "lodash"和 "yeoman-generator"引起

javascript - 来自 Github 的 Go 依赖项 - 我们能否确定它们将永远可用?

node.js - pm2 - 非 root 用户权限的启动脚本被拒绝

node.js - 构建 Dockerfile - 在中间容器之间保留文件

node.js - 使用 Socket.io 构建 Web 应用程序以支持团队协作

javascript - 客户端重新加载/离开页面后 Socket.io 服务器崩溃

javascript - gulp 在 gulp-load-plugins 错误中加载其他模式

node.js - 集群模式下的 PM2 在运行时是否生成等量的类实例?

javascript - 使用 Passport.js 的 Google+ 用户年龄范围

javascript - Node.js函数在返回数据之前返回null/实现回调