'What exact command is to install pm2 on offline RHEL
First of all it's not a duplicate question of below:-
How to install npm -g on offline server
https://stackoverflow.com/questions/40976100/how-to-installl-pm2-on-offline-server
I install npmbox (https://github.com/arei/npmbox) on my offline REHL server but I'm still do not know how to install pm2 or any other package using that.
Please advise.
Solution 1:[1]
An alternate way to install pm2 offline is:
Create the tar file with the above steps mentioned by @soren.
in my case Installation hung while executing "npm install pm2.tar.gz".
npm install pm2.tar.gz
[..................] - fetchMetadata: sill resolveWithNewModule [email protected] checking installable status
[..................] - fetchMetadata: sill resolveWithNewModule [email protected] checking installable status
to get this resolved I have added the npm registry but that did not work.
npm config set registry="http://registry.npmjs.org"
Server's are into the DMZ or in a private subnet that's it's was not working.
Solution:-
Get the install path of the node_module directory
#npm config get prefix
Extract the tar file & Copy the pm2 directory to node_module
#tar -zxvf pm2.tar.gz
#cp pm2 /usr/local/lib/node_modules/npm/node_modules/ -r
cd into the /usr/bin & Crete the simlink for pm2
# cd /usr/bin
#ln -s /usr/local/lib/node_modules/npm/node_modules/pm2/bin/pm2 pm2
check pm2 command output & its output.
# pm2
usage: pm2 [options] <command>
pm2 -h, --help all available commands and options
pm2 examples display pm2 usage examples
pm2 <command> -h help on a specific command
Access pm2 files in ~/.pm2
Solution 2:[2]
@Soren's answer work for me. to install it globally you need to pass -g argument to it.
Tested it on OpenSUSE 15 Enterprise.
for example:
ip-192-168-2-36:~ # npm install pm2-5.1.2.tgz -g
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 problematic. See https://v8.dev/blog/math-random for details.
added 181 packages, and audited 182 packages in 5s
12 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
ip-192-168-2-36:~ # pm2 -v
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
5.1.2
Without -g argument pm2 command will not work.
ip-192-168-2-36:~ # pm2
-bash: /usr/local/bin/pm2: No such file or directory
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mahendra rathod |
| Solution 2 |
