在 Ubuntu 服务器 20.04LTS 上全局安装 PM2 时出错

Error to install PM2 globally on Ubuntu Server 20.04LTS

我有一个 VM 运行ning Ubuntu 服务器 20.04LTS,我想 运行 使用 PM2 的 nodejs 程序。我在安装 pm2 npm install -g pm2@latestsudo npm install -g pm2@latest 时遇到问题。

npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/lib/node_modules/pm2/node_modules/mocha/node_modules/mkdirp/bin/cmd.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/lib/node_modules/pm2/node_modules/mocha/node_modules/mkdirp/bin/cmd.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-04T18_01_48_656Z-debug.log

Ps:我尝试了 npm install -g npm@latest 并清理了 npm 缓存,但似乎没有任何效果。该错误表明该文件不存在,但尽管知道这一点,但我不知道我能做什么或导致问题的原因。我不知道这是否会影响某些事情,但我处于 root 模式

pm2-web 的作者不久前弃用了它,因此它可能无法再卸载。

来自官方github readme:

Since it's no longer possible to monitor pm2 running on multiple machines I'm not really working on pm2-web any more.

For an alternative, check out Guvnor - a process manager with support for multiple hosts, unix based permissions, a far more capable web interface and more.

Guvnor 在 ubuntu 20.04 上也不容易安装,现在我使用 pm2.io or pm2-gui 通过 Web 界面控制我的实例。