The Module Named "pm2" is required

Never thought much about all the different mirrors that would be needed. They have dns filtering because they are a health care provider, HIPPA and all. I have requested that the system be opened to the internet. We shall see what happens.

There are many external resources required
https://wiki.freepbx.org/display/PPS/Allowed+IPs+for+PBXact+Upgrade

Thanks Lorne. I plan on checking them from the pbx tomorrow.

It’s not necessarily lots of “mirrors” (like freepbx mirrors). With node.js applications using npm to install dependencies, the dependencies are all pulled in from wherever on the internet those dependencies are kept. Most are usually on github (because lots of devs use it) but they really could be downloaded from nearly any place on the internet - essentially wherever the node application says they’re located. And those dependencies can have subdependencies declared too… soooo… they can literally be anywhere on the internet. It’s a nasty problem if you have to individually whitelist every single one.

1 Like

Thanks Matt

I logged into the system (CLI) and did a nslookup for all the domains here: Allowed IPs for PBXact Upgrade - PBX Platforms - Documentation

I got replies from all of them. I do not know where to go at this point. Could NPM be choking somehow?

@edlentz - I think you’re on a wild goose chase and it will be very challenging to walk through every dependency in the dependency tree for pm2. You need to try to just open the system up for a few minutes to make this update. That’s just my opinion.

I have asked that the system be opened up both to in and out traffic. We will see how that goes.

I had the IT manager open the system up (DMZ) and still it times out.

[root@localhost ~]# fwconsole ma upgrade pm2
No repos specified, using: [standard] from last GUI settings

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 me                            ssages are ONLY FOR DEBUGGING. Ignore anything that says 'WARN' or is just a war                            ning
Found npm-cache v0.7.0
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.js                            on: 5779f23338cdda82e1a9b20b2c91dde3
[npm-cache] [INFO] [npm] running [npm install]...
npm ERR! fetch failed http://mirror1.freepbx.org/npm/pm2-2.10.7.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT
npm ERR! fetch failed http://mirror1.freepbx.org/npm/pm2-2.10.7.tgz
npm WARN retry will retry, error on last attempt: Error: connect ETIMEDOUT
npm ERR! fetch failed http://mirror1.freepbx.org/npm/pm2-2.10.7.tgz
npm ERR! Linux 2.6.32-642.6.2.el6.i686
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v0.12.18
npm ERR! npm  v2.15.11
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect

npm ERR! network connect ETIMEDOUT
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin                            gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/html/admin/modules/pm2/node/npm-debug.log
[npm-cache] [ERROR] [npm] error running npm install
[npm-cache] [ERROR] error installing dependencies

Finished updating libraries!

There was an error installing. Please review the install log. (/var/www/html/adm                            in/modules/pm2/node/logs/install.log)
Unable to install module pm2:
 - Failed to run installation scripts
Updating Hooks...Done
Updating Hooks...Done


  [Exception]
  Unable to locate the FreePBX BMO Class 'Pm2'A required module might be disa
  bled or uninstalled. Recommended steps (run from the CLI): 1) fwconsole ma
  install pm2 2) fwconsole ma enable pm2


ma [-f|--force] [-d|--debug] [--edge] [--color] [--skipchown] [-e|--autoenable]                             [--skipdisabled] [--snapshot SNAPSHOT] [--format FORMAT] [-R|--repo REPO] [-t|--                            tag TAG] [--] [<args>]...

[root@localhost ~]#


It appears to have made some progress

on that machine try wget http://mirror1.freepbx.org/npm/pm2-2.10.7.tgz and see what happens

I tried that and got the file locally

We ran a packet capture from the firewall while I was running the fwconsole ma update pm2. It was a big file! I decided to search DNS requests. I found a request to freepbx.org. I searched for github and got nothing. I am assuming that there would be a request to github for something. Could Node.js or NPM be hosed??

Well, as per @jfinstrom - if you can’t download the pm2 package from mirror1 on the machine, you’re not going to get to the point where you’re even be able to install dependencies (which would be from other places). You’ve got to figure out why the pm2 package itself isn’t downloading.

Matt,

The system says: Module pm2 successfully downloaded its after that when npm is doing the install It looks like it wants to download the pm2 module twice. What am I missing? Is there a way to make it install the local pm2 file? I can and have downloaded it to the system using the command line.

PM2 Is Hard Coded to use the Mirror servers. It will never talk to NPM directly for itself (It will for other packages).

See: pm2/node/package.json at release/13.0 ¡ FreePBX/pm2 ¡ GitHub

It looks like your version of NPM is unable to actually do network commands. It’s pretty far out of scope of most people helping. What you should do is search the internet for how to change settings in NPM.

Heres some information about setting up proxies: Using NPM Install Behind A Corporate Proxy Server | by timothy ogbemudia | Medium

You can also do something like npm install pm2 -g which will install pm2 globally from npmjs.org but this will only tell you if there is an issue with npm and networking on your system (and you should run that after you su asterisk)

This also looks like a 13.0 system because in other releases of FreePBX PM2 the module never references mirror

See:

The only one that still references mirror is 13.0

Thanks Andrew

I tried

I got
[root@localhost ~]# su asterisk
bash-4.1$ npm install pm2 -g
Error: EACCES, scandir ‘/root’
at Error (native)

Error: EACCES, open ‘npm-debug.log.411535543’
at Error (native)

Do you think this system could be upgraded to 15 remotely and would that get us out of this pickle? Or should we get this into the shop and re install Freepbx probably version 15

You switched to the asterisk user but your current working directory is /root. You need to switch to a real directory.

2 Likes

Thanks Andrew. We decided to reimage that system and not chase after this any longer. Many thanks to the others for the help

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.