Pm2 installation on

Hello everybody,

I am trying to upgrade/update the FreePBX local installation I have and it always asks to update the pm2 before to the rest update.
Unfortunately the pm2 is not possible to be installed. I will give you the rest tech information in case someone will be available to give me a solution.
Hardware : Raspberry pi 3
Distribution : RasPBX
LInux : raspbian
root@raspbx:~# cat /etc/os-release
PRETTY_NAME=“Raspbian GNU/Linux 8 (jessie)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“8”
VERSION=“8 (jessie)”
ID=raspbian
ID_LIKE=debian

FreePBX : 14.0.17

node -v : 10.24.0
nodejs :10.24.0

-------Installation procedure---------
-1rst Attempt. From the Web Interface
The pm2 is not installed at all. The local ( not installed version is 13.0.7.2
When I try to install from the web interface of FreePBX I get the following error
Installing pm2
Installing/Updating Required Libraries. This may take a while…Running installation… …
Finished updating libraries!
There was an error installing. Please review the install log. (/var/www/html/admin/modules/pm2/node/logs/install.log)
Error(s) installing pm2:

  • Failed to run installation scripts
    Updating Hooks…Done
    =========================================================
    2nd Attempt. from the cli
    I run the “fwconsole ma upgradeall” command and I get the following output :

root@raspbx:~# fwconsole ma upgradeall
No repos specified, using: [standard,extended] from last GUI settings
Module(s) requiring upgrades: ucp, webrtc
Upgrading module ‘ucp’ from 14.0.4 to 14.0.4
Downloading module ‘ucp’
Processing ucp
Verifying local module download…Verified
Extracting…Done
Download completed in 3 seconds
Detected Missing Dependency of: pm2 13.0.3.18
Found local Dependency of: pm2 13.0.7.2
Installing Missing Dependency of: pm2 13.0.3.18
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
Running installation…
npm WARN npm npm does not support Node.js v10.24.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can’t make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at htt ps://nodejs.org/
npm ERR! code Z_DATA_ERROR
npm ERR! errno Z_DATA_ERROR
npm ERR! Invalid response body while trying to fetch http s://registry.npmjs.org/async: invalid distance too far back
npm ERR! A complete log of this run can be found in:
npm ERR! /var/lib/asterisk/.npm/_logs/2024-04-08T08_50_02_658Z-debug.log
Finished updating libraries!
There was an error installing. Please review the install log. (/var/www/html/admin/modules/pm2/node/logs/install.log)
The following error(s) occured:

  • Failed to run installation scripts
    Unable to resolve dependencies for module ucp:
    Updating Hooks…Done
    Upgrading module ‘webrtc’ from 14.0.3.11 to 14.0.3.11
    Downloading module ‘webrtc’
    Processing webrtc
    Verifying local module download…Verified
    Extracting…Done
    Download completed in 7 seconds
    Detected Missing Dependency of: ucp 12.0.0beta7
    Found local Dependency of: ucp 14.0.4
    Detected Missing Dependency of: pm2 13.0.3.18
    Found local Dependency of: pm2 13.0.7.2
    Installing Missing Dependency of: pm2 13.0.3.18
    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
    Running installation…
    npm WARN npm npm does not support Node.js v10.24.0
    npm WARN npm You should probably upgrade to a newer version of node as we
    npm WARN npm can’t make any promises that npm will work with this version.
    npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
    npm WARN npm You can find the latest version at ht tps://nodejs.org/
    npm ERR! code Z_DATA_ERROR
    npm ERR! errno Z_DATA_ERROR
    npm ERR! Invalid response body while trying to fetch htt ps://registry.npmjs.org/chalk: invalid distance too far back
    npm ERR! A complete log of this run can be found in:
    npm ERR! /var/lib/asterisk/.npm/_logs/2024-04-08T08_57_20_040Z-debug.log
    Finished updating libraries!
    There was an error installing. Please review the install log. (/var/www/html/admin/modules/pm2/node/logs/install.log)
    The following error(s) occured:
  • Failed to run installation scripts
    Unable to resolve dependencies for module webrtc:
    Updating Hooks…Done
    All upgrades completed successfully!
    Updating Hooks…Done
    ========================================
    ========================================
    The error log file shows the following
    npm WARN npm npm does not support Node.js v10.24.0
    npm WARN npm You should probably upgrade to a newer version of node as we
    npm WARN npm can’t make any promises that npm will work with this version.
    npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
    npm WARN npm You can find the latest version at ht tps://nodejs.org/
    npm ERR! code Z_DATA_ERROR
    npm ERR! errno Z_DATA_ERROR
    npm ERR! Invalid response body while trying to fetch htt ps://registry.npmjs.org/chokidar: invalid distance too far back

npm ERR! A complete log of this run can be found in:
npm ERR! /var/lib/asterisk/.npm/_logs/2024-04-08T09_56_52_881Z-debug.log

root@raspbx:~# vi /var/lib/asterisk/.npm/_logs/2024-04-08T09_56_52_881Z-debug.log
57 silly pacote range manifest for yamljs@^0.3.0 fetched in 524ms
58 silly resolveWithNewModule [email protected] checking installable status
59 silly fetchPackageMetaData error for pmx@^1.6 Invalid response body while trying to fetch htt ps://registry.npmjs.org/pmx: invalid distance too far back
60 silly fetchPackageMetaData error for v8-compile-cache@^1.1.0 Invalid response body while trying to fetch ht tps://registry.npmjs.org/v8-compile-cache: invalid distance too far back
61 silly saveTree [email protected]
61 silly saveTree └─┬ [email protected]
61 silly saveTree ├── [email protected]
61 silly saveTree ├── [email protected]
61 silly saveTree ├── [email protected]
61 silly saveTree ├── [email protected]
61 silly saveTree └── [email protected]
62 verbose type system
63 verbose stack FetchError: Invalid response body while trying to fetch htt ps://registry.npmjs.org/chokidar: invalid distance too far back
63 verbose stack at DestroyableTransform.body.on.err (/usr/share/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/body.js:195:14)
63 verbose stack at DestroyableTransform.emit (events.js:198:13)
63 verbose stack at err (/usr/share/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:191:31)
63 verbose stack at /usr/lib/nodejs/pump/index.js:75:7
63 verbose stack at f (/usr/lib/nodejs/once/once.js:25:25)
63 verbose stack at WriteStream. (/usr/lib/nodejs/pump/index.js:31:21)
63 verbose stack at WriteStream.f (/usr/lib/nodejs/once/once.js:25:25)
63 verbose stack at WriteStream.onclose (/usr/lib/nodejs/end-of-stream/index.js:48:54)
63 verbose stack at WriteStream.emit (events.js:203:15)
63 verbose stack at WriteStream.destroy (/usr/lib/nodejs/flush-write-stream/index.js:53:8)
63 verbose stack at /usr/lib/nodejs/pump/index.js:45:45
63 verbose stack at call (/usr/lib/nodejs/pump/index.js:52:3)
63 verbose stack at Array.forEach ()
63 verbose stack at /usr/lib/nodejs/pump/index.js:72:25
63 verbose stack at f (/usr/lib/nodejs/once/once.js:25:25)
63 verbose stack at Gunzip. (/usr/lib/nodejs/pump/index.js:31:21)
64 verbose cwd /var/www/html/admin/modules/pm2/node
65 verbose Linux 4.9.35-v7+
66 verbose argv “/usr/bin/node” “/usr/bin/npm” “install” “–only=production”
67 verbose node v10.24.0
68 verbose npm v5.8.0
69 error code Z_DATA_ERROR
70 error errno Z_DATA_ERROR
71 error Invalid response body while trying to fetch htt ps://registry.npmjs.org/chokidar: invalid distance too far back
72 verbose exit [ 1, true ]

========================================
Any idea ?
I think I might have to downgrade the node version but I do not know how to do it.

Thank you for your time anyway.

You have very outdated OS and FreePBX, but this thread might help

It seems that the problem is something else.
After I update the Freepbx from 13 to 14 I can’t even the “sudo apt update”
I get the follwoing error :
“apt: error while loading shared libraries: libapt-pkg.so.5.0: cannot open shared object file: No such file or directory”
I remind you that the installation was a “RasPBX” on a Raspberry pi3
Any idea ?

After a lot of online searching I manage to solve the issue with the apt.
I entered the following commands.
sudo dpkg -i libapt-pkg5.0_1.8.2.3_armhf.deb
vi /etc/resolv.conf
enter : 8.8.8.8
vi /etc/apt/sources.list
enter
deb Index of /debian buster non-free contrib main
deb Index of /debian-security buster/updates main contrib non-free
deb Index of /debian buster-updates main contrib non-free
then:
sudo apt update
fwconsole ma upgradeall

After this “odyssey” I still can’t install the pm2 in order to upgrade from Freepbx 14 to 15.

Any help will be appreciated.

Take a full backup of your current system and restore it on a brand new installation of FreePBX 16. Or wait for the full release of FreePBX 17 later this year as you’ll have to repeat that same procedure to go from 16 to 17.

Finally I manage to upgrade to FreePBX 15.
The problem is that I still can’t install the pm2 !!!
This is the error I get when I am tryign to install the pm2 on cli
0 info it worked if it ends with ok
1 warn npm npm does not support Node.js v10.24.0
2 warn npm You should probably upgrade to a newer version of node as we
3 warn npm can’t make any promises that npm will work with this version.
4 warn npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
5 warn npm You can find the latest version at https://nodejs.org/
6 verbose cli [ ‘/usr/bin/node’,
6 verbose cli ‘/usr/bin/npm’,
6 verbose cli ‘install’,
6 verbose cli ‘–only=production’ ]
7 info using [email protected]
8 info using [email protected]
9 verbose npm-session b74f90f6bad0962c
10 silly install runPreinstallTopLevelLifecycles
11 silly preinstall [email protected]
12 info lifecycle [email protected]~preinstall: [email protected]
13 silly install loadCurrentTree
14 silly install readLocalPackageData
15 silly install loadIdealTree
16 silly install cloneCurrentTreeToIdealTree
17 silly install loadShrinkwrap
18 silly install loadAllDepsIntoIdealTree
19 silly fetchPackageMetaData error for [email protected] Invalid response body while trying to fetch https://registry.npmjs.org/pm2: invalid distance too far back
20 silly fetchPackageMetaData error for [email protected] Invalid response body while trying to fetch https://registry.npmjs.org/pm2: invalid distance too far back
21 silly saveTree [email protected]
22 verbose type system
23 verbose stack FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/pm2: invalid distance too far back
23 verbose stack at DestroyableTransform.body.on.err (/usr/share/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/body.js:195:14)
23 verbose stack at DestroyableTransform.emit (events.js:198:13)
23 verbose stack at err (/usr/share/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:191:31)
23 verbose stack at /usr/lib/nodejs/pump/index.js:75:7
23 verbose stack at f (/usr/lib/nodejs/once/once.js:25:25)
23 verbose stack at WriteStream. (/usr/lib/nodejs/pump/index.js:31:21)
23 verbose stack at WriteStream.f (/usr/lib/nodejs/once/once.js:25:25)
23 verbose stack at WriteStream.onclose (/usr/lib/nodejs/end-of-stream/index.js:48:54)
23 verbose stack at WriteStream.emit (events.js:203:15)
23 verbose stack at WriteStream.destroy (/usr/lib/nodejs/flush-write-stream/index.js:53:8)
23 verbose stack at /usr/lib/nodejs/pump/index.js:45:45
23 verbose stack at call (/usr/lib/nodejs/pump/index.js:52:3)
23 verbose stack at Array.forEach ()
23 verbose stack at /usr/lib/nodejs/pump/index.js:72:25
23 verbose stack at f (/usr/lib/nodejs/once/once.js:25:25)
23 verbose stack at Gunzip. (/usr/lib/nodejs/pump/index.js:31:21)
24 verbose cwd /var/www/html/admin/modules/pm2/node
25 verbose Linux 4.9.35-v7+
26 verbose argv “/usr/bin/node” “/usr/bin/npm” “install” “–only=production”
27 verbose node v10.24.0
28 verbose npm v5.8.0
29 error code Z_DATA_ERROR
30 error errno Z_DATA_ERROR
31 error Invalid response body while trying to fetch https://registry.npmjs.org/pm2: invalid distance too far back
32 verbose exit [ 1, true ]