Unable to install module pm2: - Failed to run installation scripts

I run my updates from the command line and this morning received this:

[root@DTvoipFreePBX ~]# fwconsole ma upgradeall
… snipped for brevity …
There was an error installing. Please review the install log. (/var/www/html/admin/modules/pm2/node/logs/install.log)
Unable to install module pm2:
… snipped for brevity …

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

[root@DTvoipFreePBX ~]# fwconsole ma install pm2
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
… snipped for brevity …
npm ERR! A complete log of this run can be found in:
npm ERR! /home/asterisk/.npm/_logs/2020-07-08T14_25_06_903Z-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/admin/modules/pm2/node/logs/install.log)
Unable to install module pm2:

  • Failed to run installation scripts
    Updating Hooks…Done
    Chowning directories…Done

[root@DTvoipFreePBX ~]# cat /home/asterisk/.npm/_logs/2020-07-08T14_25_06_903Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/bin/node’, ‘/usr/bin/npm’, ‘install’ ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 035e693e9442e105
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall [email protected]
7 info lifecycle [email protected]~preinstall: [email protected]
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 silly install loadAllDepsIntoIdealTree
14 http fetch GET 200 http://mirror1.freepbx.org/npm/pm2-2.10.7.tgz 112ms (from cache)
15 silly pacote remote manifest for pm2@http://mirror1.freepbx.org/npm/pm2-2.10.7.tgz fetched in 198ms
16 silly resolveWithNewModule [email protected] checking installable status
17 http fetch GET 200 https://registry.npmjs.org/cli-table-redemption 179ms (from cache)
18 silly pacote range manifest for cli-table-redemption@^1.0.0 fetched in 184ms
19 silly resolveWithNewModule [email protected] checking installable status
20 warn registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ENODATA: Cache input stream was empty
21 warn registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
22 silly fetchPackageMetaData error for chokidar@^2 Invalid response body while trying to fetch https://registry.npmjs.org/chokidar: Integrity verification failed for sha512-d/3TJbXAZDx42qlLnXQ8mCinrARvtT1mC+47+VudUTifxwP5IEIEVMASK8ikOaTUl+cSMl44pCiTIeIG6YQDfw== (/home/asterisk/.npm/_cacache/content-v2/sha512/77/fd/d325b5c0643c78daa94b9d743c9828a7ac046fb53d660bee3bf95b9d51389fc703f920420454c0122bc8a439a4d497e712325e38a4289321e206e984037f)
23 silly fetchPackageMetaData error for debug@^3.0 Invalid response body while trying to fetch https://registry.npmjs.org/debug: Integrity verification failed for sha512-P0Xl75/i/ONW88P6UKJl3d9M4tx71qYEz1xcLSqAR7o1NqBLpaJZNJDtodiHYtoryC/gqBuDcjnymRvRt3+9zQ== (/home/asterisk/.npm/_cacache/content-v2/sha512/3f/45/e5ef9fe2fce356f3c3fa50a265dddf4ce2dc7bd6a604cf5c5c2d2a8047ba3536a04ba5a2593490eda1d88762da2bc82fe0a81b837239f2991bd1b77fbdcd)
24 http fetch GET 304 https://registry.npmjs.org/fclone 583ms (from cache)
25 http fetch GET 304 https://registry.npmjs.org/blessed 594ms (from cache)
26 http fetch GET 304 https://registry.npmjs.org/eventemitter2 591ms (from cache)
27 http fetch GET 304 https://registry.npmjs.org/mkdirp 411ms (from cache)
28 http fetch GET 304 https://registry.npmjs.org/chalk 604ms (from cache)
29 http fetch GET 304 https://registry.npmjs.org/cron 603ms (from cache)
30 http fetch GET 304 https://registry.npmjs.org/async 618ms (from cache)
31 silly pacote version manifest for [email protected] fetched in 610ms
32 silly resolveWithNewModule [email protected] checking installable status
33 silly pacote range manifest for blessed@^0.1.81 fetched in 624ms
34 silly resolveWithNewModule [email protected] checking installable status
35 http fetch GET 304 https://registry.npmjs.org/commander 621ms (from cache)
36 silly pacote version manifest for [email protected] fetched in 632ms
37 silly resolveWithNewModule [email protected] checking installable status
38 silly pacote version manifest for [email protected] fetched in 456ms
39 silly resolveWithNewModule [email protected] checking installable status
40 silly pacote range manifest for chalk@^1.1 fetched in 650ms
41 silly resolveWithNewModule [email protected] checking installable status
42 silly pacote range manifest for cron@~1.3.0 fetched in 649ms
43 silly resolveWithNewModule [email protected] checking installable status
44 silly pacote range manifest for async@^2.5 fetched in 672ms
45 silly resolveWithNewModule [email protected] checking installable status
46 silly pacote version manifest for [email protected] fetched in 665ms
47 silly resolveWithNewModule [email protected] checking installable status
48 http fetch GET 200 https://registry.npmjs.org/pidusage 97ms (from cache)
49 http fetch GET 200 https://registry.npmjs.org/pmx 82ms (from cache)
50 silly pacote range manifest for pidusage@^1.2.0 fetched in 120ms
51 silly resolveWithNewModule [email protected] checking installable status
52 silly fetchPackageMetaData error for [email protected] Invalid response body while trying to fetch https://registry.npmjs.org/needle: Integrity verification failed for sha512-CWNyvIwgFSfoU76XyT71DNCH1XUeJfrkPYojyhn4SUdqlDI9D9I+uUi7nnVXqzW5btOgM8HZDwcmlOdbV2el5g== (/home/asterisk/.npm/_cacache/content-v2/sha512/09/63/72bc8c201527e853be97c93ef50cd087d5751e25fae43d8a23ca19f849476a94323d0fd23eb948bb9e7557ab35b96ed3a033c1d90f072694e75b5767a5e6)
53 silly pacote range manifest for pmx@^1.6 fetched in 117ms
54 silly resolveWithNewModule [email protected] checking installable status
55 http fetch GET 200 https://registry.npmjs.org/shelljs 68ms (from cache)
56 http fetch GET 304 https://registry.npmjs.org/moment 292ms (from cache)
57 silly pacote version manifest for [email protected] fetched in 89ms
58 silly resolveWithNewModule [email protected] checking installable status
59 silly pacote range manifest for moment@^2.19 fetched in 324ms
60 silly resolveWithNewModule [email protected] checking installable status
61 http fetch GET 304 https://registry.npmjs.org/nssocket 269ms (from cache)
62 http fetch GET 304 https://registry.npmjs.org/pm2-axon 261ms (from cache)
63 http fetch GET 304 https://registry.npmjs.org/pm2-deploy 264ms (from cache)
64 http fetch GET 304 https://registry.npmjs.org/pm2-axon-rpc 269ms (from cache)
65 silly pacote version manifest for [email protected] fetched in 288ms
66 silly resolveWithNewModule [email protected] checking installable status
67 silly pacote version manifest for [email protected] fetched in 282ms
68 silly resolveWithNewModule [email protected] checking installable status
69 http fetch GET 304 https://registry.npmjs.org/promptly 260ms (from cache)
70 http fetch GET 304 https://registry.npmjs.org/pm2-multimeter 279ms (from cache)
71 silly pacote range manifest for pm2-deploy@^0.3.9 fetched in 285ms
72 silly resolveWithNewModule [email protected] checking installable status
73 silly pacote range manifest for pm2-axon-rpc@^0.5.1 fetched in 297ms
74 silly resolveWithNewModule [email protected] checking installable status
75 silly pacote version manifest for [email protected] fetched in 300ms
76 silly resolveWithNewModule [email protected] checking installable status
77 silly fetchPackageMetaData error for source-map-support@^0.5 Invalid response body while trying to fetch https://registry.npmjs.org/source-map-support: Integrity verification failed for sha512-99mHjHhZSy24zl3wNKJV1yDdm39zBSpXipqT8+W8HrPGgZCTkFrDFtHehdbn7O0XvDeAVBAXfyp9wtYJKWPrkg== (/home/asterisk/.npm/_cacache/content-v2/sha512/f7/d9/878c78594b2db8ce5df034a255d720dd9b7f73052a578a9a93f3e5bc1eb3c6819093905ac316d1de85d6e7eced17bc37805410177f2a7dc2d6092963eb92)
78 silly pacote range manifest for pm2-multimeter@^0.1.2 fetched in 321ms
79 silly resolveWithNewModule [email protected] checking installable status
80 http fetch GET 304 https://registry.npmjs.org/semver 230ms (from cache)
81 http fetch GET 200 https://tgz.pm2.io/gkt-1.0.0.tgz 59ms (from cache)
82 silly pacote range manifest for semver@^5.3 fetched in 251ms
83 silly resolveWithNewModule [email protected] checking installable status
84 silly fetchPackageMetaData error for [email protected] Invalid response body while trying to fetch https://registry.npmjs.org/sprintf-js: Integrity verification failed for sha512-iYuTV2tFCjZxa9ad5ktGoEjoxOZwa/dWdlYqpsSmymoe0VpffMXvRAfcFPihRv+pN3gZIHoOr+dRKTRGWDtClQ== (/home/asterisk/.npm/_cacache/content-v2/sha512/89/8b/93576b450a36716bd69de64b46a048e8c4e6706bf75676562aa6c4a6ca6a1ed15a5f7cc5ef4407dc14f8a146ffa9377819207a0eafe751293446583b4295)
85 silly pacote remote manifest for gkt@https://tgz.pm2.io/gkt-1.0.0.tgz fetched in 85ms
86 silly resolveWithNewModule [email protected] checking installable status
87 http fetch GET 304 https://registry.npmjs.org/v8-compile-cache 149ms (from cache)
88 silly pacote range manifest for v8-compile-cache@^1.1.0 fetched in 153ms
89 silly resolveWithNewModule [email protected] checking installable status
90 http fetch GET 304 https://registry.npmjs.org/vizion 108ms (from cache)
91 http fetch GET 304 https://registry.npmjs.org/yamljs 110ms (from cache)
92 silly pacote range manifest for vizion@^0.2 fetched in 114ms
93 silly resolveWithNewModule [email protected] checking installable status
94 silly pacote range manifest for yamljs@^0.3.0 fetched in 115ms
95 silly resolveWithNewModule [email protected] checking installable status
96 silly saveTree [email protected]
96 silly saveTree └─┬ [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├─┬ [email protected]
96 silly saveTree │ └── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree ├── [email protected]
96 silly saveTree └── [email protected]
97 verbose type system
98 verbose stack FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/chokidar: Integrity verification failed for sha512-d/3TJbXAZDx42qlLnXQ8mCinrARvtT1mC+47+VudUTifxwP5IEIEVMASK8ikOaTUl+cSMl44pCiTIeIG6YQDfw== (/home/asterisk/.npm/_cacache/content-v2/sha512/77/fd/d325b5c0643c78daa94b9d743c9828a7ac046fb53d660bee3bf95b9d51389fc703f920420454c0122bc8a439a4d497e712325e38a4289321e206e984037f)
98 verbose stack at Readable.body.on.err (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/body.js:195:14)
98 verbose stack at emitOne (events.js:116:13)
98 verbose stack at Readable.emit (events.js:211:7)
98 verbose stack at cacache.get.byDigest.then.err (/usr/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:94:30)
98 verbose stack at tryCatcher (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
98 verbose stack at Promise._settlePromiseFromHandler (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
98 verbose stack at Promise._settlePromise (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
98 verbose stack at Promise._settlePromise0 (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
98 verbose stack at Promise._settlePromises (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:689:18)
98 verbose stack at Async._drainQueue (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
98 verbose stack at Async._drainQueues (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
98 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
98 verbose stack at runCallback (timers.js:810:20)
98 verbose stack at tryOnImmediate (timers.js:768:5)
98 verbose stack at processImmediate [as _immediateCallback] (timers.js:745:5)
99 verbose cwd /var/www/html/admin/modules/pm2/node
100 verbose Linux 3.10.0-957.21.3.el7.x86_64
101 verbose argv “/usr/bin/node” “/usr/bin/npm” “install”
102 verbose node v8.11.3
103 verbose npm v5.6.0
104 error code EINTEGRITY
105 error errno EINTEGRITY
106 error Invalid response body while trying to fetch https://registry.npmjs.org/chokidar: Integrity verification failed for sha512-d/3TJbXAZDx42qlLnXQ8mCinrARvtT1mC+47+VudUTifxwP5IEIEVMASK8ikOaTUl+cSMl44pCiTIeIG6YQDfw== (/home/asterisk/.npm/_cacache/content-v2/sha512/77/fd/d325b5c0643c78daa94b9d743c9828a7ac046fb53d660bee3bf95b9d51389fc703f920420454c0122bc8a439a4d497e712325e38a4289321e206e984037f)
107 verbose exit [ 1, true ]

Further searches are yielding little help.

Suggestions or instructions anyone?

Hi, did you try with a yum update first ? It seems that something is going wrong with node.

Yes, I did.
I have not researched if there is some “yum update force” type command to try.
So far the system is still running but, I am concerned that this is going to become a more serious issue.

This morning I get an email that “upgrades are available”. Run “fwconsole ma upgradeall” and while ‘framework’ is upgrading I get the following:

Chowning directories…
In Self_Helper.class.php line 212:

Unable to locate the FreePBX BMO Class 'Pm2’A required module might be dis
abled or uninstalled. Recommended steps (run from the CLI): 1) fwconsole m
a install pm2 2) fwconsole ma enable pm2
When

Running “fwconsole ma install pm2” simply “hangs”, seemingly doing nothing. After five (5) minutes, I stopped it with a “ctrl +c” keystroke.
Any help, please?

Do you have something like a web content filter on your router? If you have it, disable that.
What happens when you run a yum update?

So, npm is a package manager for Javascript. We run a npm install when a new module is installed for FreePBX. The reason for the failure is that a package on npm’s servers has been changed in an unexpected way. This could be malicious but I am not sure.

Whatever it was, it seems like npm resolved the issue. I’m able to install the pm2 module on my system. I would try it again and see if you have any issues.

You may have to do the following:

fwconsole ma remove pm2 --force
fwconsole ma downloadinstall pm2
1 Like

That does not work:
[root@FreePBX ~]# fwconsole ma remove pm2 --force
The following error(s) occured:

  • Failed to run un-installation scripts
    I have also tried:
    [root@FreePBX ~]# fwconsole ma delete pm2
    The following error(s) occured:
  • Cannot disable: The following modules depend on this one: api,restapps,ucp,vqplus,xmpp,zulu
    [root@FreePBX ~]# fwconsole ma uninstall pm2
    The following error(s) occured:
  • Cannot disable: The following modules depend on this one: api,restapps,ucp,vqplus,xmpp,zulu

This morning when I ran fwconsole ma upgradeall the upgrade hung at:
Upgrading module ‘pm2’ from 15.0.3.8 to 15.0.3.8
Downloading module ‘pm2’
Processing pm2
Verifying local module download…Verified
Extracting…Done
Download completed in 0 seconds <<<<< This “0” seconds stuck me as very odd.

After a few minutes (3?) I “control +c” to stop it. (The other day, when it hung in the same installing pm2, I left it in a “hung” state for more than ten minutes, thinking the install was doing something in the background. Eventually I stopped it with “control + c”.)

And finally this morning this after running fwconsole ma upgradeall the following (which “hung” at pm2):
[root@FreePBX ~]# fwconsole reload -vvv
Reload Started

In Self_Helper.class.php line 212:

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

Exception trace:
() at /var/www/html/admin/libraries/BMO/Self_Helper.class.php:212
FreePBX\Self_Helper->loadObject() at /var/www/html/admin/libraries/BMO/Self_Helper.class.php:106
FreePBX\Self_Helper->autoLoad() at /var/www/html/admin/libraries/BMO/Self_Helper.class.php:37
FreePBX\Self_Helper->__get() at /var/www/html/admin/modules/iotserver/Iotserver.class.php:66
FreePBX\modules\Iotserver->__construct() at /var/www/html/admin/libraries/BMO/Self_Helper.class.php:124
FreePBX\Self_Helper->autoLoad() at /var/www/html/admin/libraries/BMO/Self_Helper.class.php:37
FreePBX\Self_Helper->__get() at /var/www/html/admin/libraries/BMO/Hooks.class.php:393
FreePBX\Hooks->preloadBMOModules() at /var/www/html/admin/libraries/BMO/Hooks.class.php:39
FreePBX\Hooks->updateBMOHooks() at /var/www/html/admin/libraries/BMO/Hooks.class.php:238
FreePBX\Hooks->processHooksByClassMethod() at /var/www/html/admin/libraries/Console/Reload.class.php:99
FreePBX\Console\Command\Reload->reload() at /var/www/html/admin/libraries/Console/Reload.class.php:90
FreePBX\Console\Command\Reload->execute() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:960
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:255
Symfony\Component\Console\Application->doRun() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /var/lib/asterisk/bin/fwconsole:163

reload [–json] [–dry-run] [–skip-registry-checks] [–dont-reload-asterisk]

Any other suggestions?

Not sure if this is relevant but what version of nodejs are you using, on my builds i find v11 successfully builds pm2 but v10 or v12 dont

I do not know how to determine what version of nodejs? I dabble in command line but in the case of FreePBX, I depend more on the GUI. As I cannot see the GUI right now (due to pm2 issue) I would need to have some guidance in how to find nodejs version in use?
Most likely a simple command line string but, you will need to post it so I can run the string. Sorry, I am a novice.

node -v

@bob_dt Let’s try to remove all of the places where we cache data for node:

fwconsole ma remove pm2 --force
rm -rf /home/asterisk/.package_cache/npm/
rm -rf /home/asterisk/.npm
fwconsole ma downloadinstall pm2 

See if this fixes anything please

1 Like

I reported this as a bug. This was resolved with the timely release of a new update that corrected a json error issue (in python??) Then I had to run the commands Mbrooks suggested and reboot. All was well after that.

What was the bug and what file did they provide for installtion?

Can you post the file on here please?

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