Search code examples
node.jsnpmpm2ubuntu-server

Error to install PM2 globally on Ubuntu Server 20.04LTS


I have a VM running Ubuntu Server 20.04LTS and I want to run a nodejs program using PM2. I'm having problems to install pm2 npm install -g pm2@latest and sudo 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: I tried npm install -g npm@latest and cleaning npm cache but nothing seems to work. The error says that this file doesn't exist but despite knowing that, I don't know what I can do or what is causing the problem. I don't know if this affects something but I'm on root mode


Solution

  • The author of pm2-web deprecated it a while ago, so it might be uninstallable any more.

    from the official 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 too wasn't easily installable on ubuntu 20.04, right now I use pm2.io or pm2-gui to control my instances via web interface.