I just ran across this thread using the forum’s search and did not realise that it was that aged
If you look closer, nodejs has been installed with the latest version.
I followed the recommendation and have fired the command
sudo apt -y install npm
that yields to the following output
pi@raspberrypi:~ $ sudo 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
npm WARN deprecated [email protected]: This version of 'is-buffer' is out-of-date. You must update to v1.1.6 or newer
npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.
Installed npm-cache v0.7.0
Running installation..
[npm-cache] [INFO] using /var/lib/asterisk/.package_cache as cache directory
[npm-cache] [INFO] creating 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: 85572006fc146627568451ddd4f8eb7c
[npm-cache] [INFO] [npm] running [npm install]...
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problema tic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommend ed you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
added 210 packages, and audited 211 packages in 1m
10 packages are looking for funding
run `npm fund` for details
10 vulnerabilities (1 moderate, 7 high, 2 critical)
To address issues that do not require attention, run:
npm audit fix
To address all issues, run:
npm audit fix --force
Run `npm audit` for details.
[npm-cache] [INFO] [npm] installed npm dependencies, now archiving
[npm-cache] [INFO] [npm] archiving dependencies from /var/www/html/admin/modules/pm2/node/node_modules
[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] installed and archived dependencies
[npm-cache] [INFO] successfully installed all dependencies
Finished updating libraries!
Generating CSS...Done
Module pm2 version 16.0.5 successfully installed
Updating Hooks...Done
Chowning directories...Done
From above output, not sure if I have to pay attention to any of the verbose messages printed…
I realize this is an old thread but it might work for my issue. We can not update PM2 and get the “unable to install module PM2” error. In another thread it was eluded to that the version of Nodejs was the culpret. Doing a node -v gave me 0.12.18 Version 12 was not compatable per that thread. I am unable to remove PM2 at all. The link to changing Node.js version is quite old is it still viable?
Dont know if it’s necessarily the most graceful way to do it but you can use --force to reinstall broken modules sometimes. I’ve run this one half a dozen times with good results.
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 messages are ONLY FOR DEBUGGING. Ignore anything that says 'WARN' or is just a warning
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.json: 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`
```
Worked
I contacted the IT company for this site and there is some DNS filtering, He was going to allow the freepbx.org domain. Haven’t heard whether he has done it or not
Update:
The install still timed out.
No matter what I do it hangs at
[npm-cache] [INFO] [npm] running [npm install]…
Not sure, but if that’s failing, something’s not right. You’re going to need open internet access to lots of places (not just freepbx.org) to be able to install all the dependencies of pm2 via npm. Maybe that’s where it’s failing.