-
Notifications
You must be signed in to change notification settings - Fork 6
Description
This is a guide to installing PM2 on IBM i. I recommend either using Node.js 8 or Node.js v10 with PM2, which are both available via yum.
Step 1
Check you have Node.js installed. If running node -v doesn't show you the version and instead errors that it can't find the correct version of node, you may need to add the package installation directory to your $PATH: PATH=/QOpenSys/pkgs/bin:$PATH. If you are running Node.js 6, I suggest you install yum to update.
Step 2
Install pm2 with npm.
-bash-4.3$ npm i -g pm2
/QOpenSys/pkgs/lib/nodejs10/bin/pm2 -> /QOpenSys/pkgs/lib/nodejs10/lib/node_modules/pm2/bin/pm2
/QOpenSys/pkgs/lib/nodejs10/bin/pm2-docker -> /QOpenSys/pkgs/lib/nodejs10/lib/node_modules/pm2/bin/pm2-docker
/QOpenSys/pkgs/lib/nodejs10/bin/pm2-dev -> /QOpenSys/pkgs/lib/nodejs10/lib/node_modules/pm2/bin/pm2-dev
/QOpenSys/pkgs/lib/nodejs10/bin/pm2-runtime -> /QOpenSys/pkgs/lib/nodejs10/lib/node_modules/pm2/bin/pm2-runtime
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/pm2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4:
wanted {"os":"darwin","arch":"any"} (current: {"os":"aix","arch":"ppc64"})
+ pm2@3.2.2
added 261 packages from 225 contributors in 24.028s
Step 3
Test the pm2 command. If you execute pm2 and get command not found, then you need to add the Node.js bin library to your path. Note that the Node.js bin directory is different for different Node.js versions.
-bash-4.3$ pm2
-bash: pm2: command not found
-bash-4.3$ PATH=/QOpenSys/pkgs/lib/nodejs10/bin:$PATH
-bash-4.3$ pm2
usage: pm2 [options]
pm2 -h, --help all available commands and options
pm2 examples display pm2 usage examples
pm2 -h help on a specific command
Access pm2 files in ~/.pm2
That's it
You now have PM2. You may want to set up a .profile to add the Node.js bin directory to your $PATH (like we did above) automatically.
PATH=/QOpenSys/pkgs/bin:/QOpenSys/pkgs/lib/nodejs10/bin:$PATH