The Module Named "pm2" is required

Hi!

Install “Process Management” in Module Admin…

For some weird reason the very short “internal name” of that module (pm2) is used when dependencies are shown instead of its description (“Process Management”).

I never noticed and it most likely always does that but this time the module name does not help much figure out what to install…

Good luck and have a nice day!

Nick

4 Likes

Great…worked for me…thanks adventurer

2 Likes

This didn’t work for me:

# fwconsole ma downloadinstall pm2
No repos specified, using: [standard,extended,unsupported] from last GUI settings

Starting pm2 download..
Processing pm2
Verifying local module download...Verified
Extracting...Done
Module pm2 successfully downloaded
sh: 1: node: not found
Node is not installed
Unable to install module pm2:
 - Failed to run installation scripts
Updating Hooks...Done

Any ideas?

The answer is right there. You need to install nodejs

1 Like

Nope.

# fwconsole ma downloadinstall nodejs
No repos specified, using: [standard,extended,unsupported] from last GUI settings

Starting nodejs download..
The following error(s) occured:
 - Retrieved Module XML Was Empty
yum install nodejs
2 Likes

Just figured out that it is an OS level package. In my case:

apt-get install nodejs
apt-get install node

But alas still no go on pm2:

# fwconsole ma downloadinstall pm2
No repos specified, using: [standard,extended,unsupported] from last GUI settings

Starting pm2 download..
Processing pm2
Verifying local module download...Verified
Extracting...Done
Module pm2 successfully downloaded
sh: 1: node: not found
Node is not installed
Unable to install module pm2:
 - Failed to run installation scripts
Updating Hooks...Done

Found a hint that the correct package for Raspian is nodejs-legacy. After removing the first two and installing that I get:

# fwconsole ma downloadinstall pm2
No repos specified, using: [standard,extended,unsupported] from last GUI settings

Starting pm2 download..
Processing pm2
Verifying local module download...Verified
Extracting...Done
Module pm2 successfully downloaded
Node version is: 0.10.29 requirement is 0.12.18. Run 'yum upgrade nodejs' from the CLI as root
Unable to install module pm2:
 - Failed to run installation scripts
Updating Hooks...Done

Sorry but you need to install nodejs 0.12.18 or higher. This is most easily accomplished by using the FreePBX Distro. Since you are on a Raspian there’s not much we can do other than tell you that you need 0.12.18 or higher.

Node JS is not a module in FreePBX. It is a requirement outside of that. When you use systems that are not the FreePBX Distro you will most likely have to build things manually or find them somewhere else.

The command that is run to check node and npm is:

node --version
npm --version
2 Likes

Figured it out. I installed nodejs following the instructions here:

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

Then the pm2 install worked:

# fwconsole ma downloadinstall pm2   
...
 Finished updating libraries!
    Generating CSS...Done
    Module pm2 successfully installed
Updating Hooks...Done

# node -v
v6.10.2

Thank you for the help.

3 Likes

Having some similar trouble installing the proper version of nodejs to be able to install pm2.

Using CentOS 6.9 and FreePBX 13

I used these instructions to install nodejs

But when I try and run:

#fwconsole ma downloadinstall pm2
No repos specified, using: [standard,extended,unsupported,commercial] from last GUI settings

Starting pm2 download..
Processing pm2
Verifying local module download...Verified
Extracting...Done
Module pm2 successfully downloaded
Node version is: 0.10.48 requirement is 0.12.18. Run 'yum upgrade nodejs' from the CLI as root
Unable to install module pm2:
 - Failed to run installation scripts
Updating Hooks...Done

#yum upgrade nodejs
Loaded plugins: fastestmirror, security
Setting up Upgrade Process
Loading mirror speeds from cached hostfile
 * epel: fedora-epel.mirror.lstn.net
No Packages marked for Update

I can see that I don’t have the right version of nodjs but can’t figure out how to upgrade. This is more of OS issue than a freepbx issue but perhaps someone could nudge me in the right direction?

Since you aren’t using the distro (and if you are DO NOT DO THIS)

curl -sL https://rpm.nodesource.com/setup_0.12 | bash -
yum install -y nodejs

I had the same issue for a new distro install. I downloaded the distro USB image yesterday.

If you are running the free pbx distro the yum install nodejs will work for you it is a recent dependency for some recently upgraded modules

If you are running the distro, and keeping current with distro updates, then you would already have nodejs installed:
https://wiki.freepbx.org/display/PPS/Updating+FreePBX+Official+Distro

Process Management is found in Module Admin under Extended modules not Standard.

I am getting the same error. FreePBX Distro 13.0.192.9 with all current updates. Run “yum install nodejs” and get

Package nodejs-0.12.18-1nodesource.el6.x86_64 already installed and latest version. Nothing to do

Run “fwconsole ma downloadinstall pm2” and get the following two errors:

[npm-cache] [INFO] [composer] Dependency config file /var/www/html/admin/modules/pm2/node/composer.json does not exist. Skipping install

[npm-cache] [INFO] [bower] Dependency config file /var/www/html/admin/modules/pm2/node/bower.json does not exist. Skipping install

Any ideas how to fix this? In Module Admin, PM2 is “Disabled: Pending upgrade to 13.0.3.15” The current version shows as 13.0.3.13

Those aren’t errors. Can you provide the full output.

not trying to hijack but have similar issue,

PBX Firmware:10.13.66-20
PBX Service Pack:1.0.0.0

removed nodejs and re-installed nodejs,
tried PM2 on giu and on cli with same result;

Installed:
nodejs.x86_64 0:0.12.18-1nodesource.el6

Starting pm2 download…
Processing pm2
Verifying local module download…Verified
Extracting…Done
Module pm2 successfully downloaded
Installing/Updating Required Libraries. This may take a while…The following messages are ONLY FOR DEBUGGING. Ignore anything that says ‘WARN’ or is just a warning
Found npm-cache v0.6.5
Running installation…[npm-cache] [INFO] using /home/asterisk/.package_cache as cache directory
[npm-cache] [INFO] [composer] Dependency config file /var/www/html/admin/modules/pm2/node/composer.json does not exist. Skipping install
[npm-cache] [INFO] [npm] config file exists
[npm-cache] [INFO] [npm] cli exists
[npm-cache] [INFO] [npm] hash of /var/www/html/admin/modules/pm2/node/package.json: b84d380aaab5f619c0c9f4060cc86a0c
[npm-cache] [INFO] [npm] cache exists
[npm-cache] [INFO] [npm] clearing installed dependencies at /var/www/html/admin/modules/pm2/node/node_modules
[npm-cache] [INFO] [npm] …cleared
[npm-cache] [INFO] [npm] retrieving dependencies from /home/asterisk/.package_cache/npm/2.15.11/b84d380aaab5f619c0c9f4060cc86a0c.tar.gz
[npm-cache] [INFO] [bower] Dependency config file /var/www/html/admin/modules/pm2/node/bower.json does not exist. Skipping install
[npm-cache] [INFO] [npm] done extracting
[npm-cache] [INFO] successfully installed all dependencies

Finished updating libraries!

[Symfony\Component\Process\Exception\ProcessFailedException]
The command “runuser ‘asterisk’ -c 'cd /var/www/html/admin/modules/pm2/node
&& mkdir -p /home/asterisk/.pm2 && mkdir -p /var/www/html/admin/modules/pm
2/node/logs && export HOME=”/home/asterisk" && export PM2_HOME="/home/aster
isk/.pm2" && export ASTLOGDIR="/var/log/asterisk" && export ASTVARLIBDIR="/
var/lib/asterisk" && export PATH="$HOME/.node/bin:$PATH" && export NODE_PAT
H="$HOME/.node/lib/node_modules:$NODE_PATH" && export MANPATH="$HOME/.node/
share/man:$MANPATH" && /var/www/html/admin/modules/pm2/node/node_modules/pm
2/bin/pm2 ping’" failed.
Exit Code: 1(General error)
Output:

Error Output:

module.js:338
throw err;
^
Error: Cannot find module 'debug’
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/var/www/html/admin/modules/pm2/node/node_module
s/pm2/constants.js:7:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions…js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)

ma [-f|–force] [-d|–debug] [–edge] [–color] [–skipchown] [-e|–autoenable] [–skipdisabled] [–format="…"] [-R|–repo="…"] [-t|–tag="…"] [args1] … [argsN]

(also removed PM2 once or twice) pure distro no addons, no changes

Hello @able,

I stumbled on this problem with some of my servers. For some reason the nodejs modules are not downloaded with the rest of the PM2 module (especially the debug module). I guess it is a timeout of one of the HTTP servers somewhere in the way because many of my Freepbx servers are being upgraded fine with the PM2 module.

What I am doing to bypass this problem is just copying a working PM2 module directory from another server with SCP and then I am “installing” the PM2 module.

Let us assume that you have a working and updated PM2 module with an ip address of 1.1.1.1 and a non working Freepbx server with an ip address of 2.2.2.2

Here are the steps:

  1. Remove the PM2 module directory from the non working Freepbx (2.2.2.2)
    rm -rf /var/www/html/admin/modules/pm2

  2. Copy the working PM2 directory from 1.1.1.1 to 2.2.2.2
    scp -r /var/www/html/admin/modules/pm2 [email protected]:/var/www/html/admin/modules/

  3. Install the PM2 module on 2.2.2.2 after the copy of the working module
    fwconsole ma install pm2

  4. Upgrade the rest of the modules on 2.2.2.2
    fwconsole ma upgradeall

  5. Reload the Freepbx framework on 2.2.2.2
    fwconsole reload

  6. Restart the Freepbx framework
    fwconsole stop && fwconsole start

Thank you,

Daniel Friedman
Trixton LTD.