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)
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:
Remove the PM2 module directory from the non working Freepbx (2.2.2.2) rm -rf /var/www/html/admin/modules/pm2
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/
Install the PM2 module on 2.2.2.2 after the copy of the working module fwconsole ma install pm2
Upgrade the rest of the modules on 2.2.2.2 fwconsole ma upgradeall
Reload the Freepbx framework on 2.2.2.2 fwconsole reload
Restart the Freepbx framework fwconsole stop && fwconsole start
thanks for taking the time to write this all out, i tried this and made sure i had the same version server, but sadly the error is the same, it is only 1 of 8 machines doing this!
i may have to re-install that one!
Did you copied a working pm2 directory? Can you share again your logs on just installing the pm2 module?
It sounds that you did not copied it correctly.
I deleted the exisint pm2 directory, than copied it from another servert to the one in question, changed ownership on the pm2 directory to aserisk and ran the install. reload, restart.
the error output is exactly the same as is the error message, hence my thought to re-install it, as this is a problem that may not be in the first place related to the PM2 module is working fine (debug is working fine, nodejs is fine, all tested)
Yes, I missed the part that he uses the distro. I stumbled on the exact problem with some of my servers and managed to bypass the problem by copying the pm2 directory from a working server and installing it manually as I stated in my previous post.
You know that you did not answered my problem of why is the node_modules directory is not downloaded with the pm2 module in my bug report. Do you have an idea of what might be the problem?
It’s not downloaded with the module because in some cases that folder is huge and in other cases it contains code that is compiled specifically for your system.
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_modules/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)
ok tried in several different ways and it simply cmes back with the same error as above in every which way.
went as far as to get rid of zulu xmpp and sangomacrm tried to reinstall from gui, no go same error, removed and cli installed, same error, removed downloaded from working server, installed, same error.
Use yum to upgrade my nodejs from the command line (I had an older version installed)
Run npm install from the /var/www/html/admin/modules/pm2/node/node_modules/pm2 directory (not /var/www/html/admin/modules/pm2!)
After I did those steps the PM2 module installed without error.
i have here the same problem on one machine, running 10.13.66-20.
i tried the recommendation with copy over /var/www/html/admin/modules/pm2 from a working box.
it seems there a timeframe when you start
fwconsole ma install pm2
i tried it 3x until it got installed.
Then i ran fwconsole ma upgradeall
which upgraded the packages.
but after login the webconsole there was errors about tampered pm2 files
Also there was several errors about missing files pm2/node??/bin/pm2
so i ran
fwconsole ma refreshsignatures
which cleared out the pm2 directory again and has an other content.
i am unsure how to get the modules up and running correctly.
Also i am wondering, what is the reason, as there are several different machines and only some seems to have the problem.
Could it be there’s diskspaceproblem, from mongodb?
Cause i am running with a 10GB disk, where i have only 1.7GB free.
All the installation steps applied for Asterisk 16 (detailled version: Asterisk 16.16.1~dfsg-1+deb11u1) and FreePBX 16 (detailled version: 16.0.10.33) worked fine up to the point where I am getting a complain for the installation of the PM2 module.
Here is the output when manually launching the respective commands on the shell prompt:
pi@raspberrypi: $ sudo apt install nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
nodejs is already the newest version (12.22.5~dfsg-2~11u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi: $ node -v
v12.22.5
pi@raspberrypi: $ sudo fwconsole ma install pm2
sh: 1: npm: not found
Node Package Manager is not installed
Unable to install module pm2:
- Failed to run installation scripts
Updating Hooks...Done
Chowning directories...Done
From above I read that “npm” cannot be found, and, as such, the installation script fails.
So I went further, and have created the “npm” file with a symbolic link to “node” as outlined with:
ln -s /usr/bin/node /usr/bin/npm
Though, when manually running the installation of the PM2 module, I am getting the following output:
pi@raspberrypi: $ sudo fwconsole ma install pm2
NPM version is: v12.22.5 requirement is 2.15.11. Run 'yum upgrade nodejs' from the CLI as root
Unable to install module pm2:
- Failed to run installation scripts
Updating Hooks...Done
Chowning directories...Done
for context, its considered bad manners to repoen a thread from 2017 to tack on something like this…
I’d recommend opening a new thread for your specific issues.
But… the log literally tells you what to do… Run 'yum upgrade nodejs' from the CLI as root