Verify Node.js Environment on IBM i
Node.js runs in the PASE environment on IBM i, like many other open source technologies. The steps on this page can be used to verify that Node.js has been properly installed.
Step 1: Starting a PASE Environment
A PASE session can be started on an IBM i in a 5250 session with the following command:
CALL QP2TERM
Alternatively, you can start a terminal session through Git Bash, Powershell, PuTTY, or similar PC client. These solutions would require that your IBM i have SSH set up. You can refer to the following document for details on how to set up SSH on IBM i.
Step 2: Add Opensource Installation Directory to PATH Environment Variable
Open source packages are installed into /QOpenSys/pkgs/bin on an IBM i. If not done already, you will need to add the open source installation directory to your PATH environment variable. This can be done with the following commands:
PATH=/QOpenSys/pkgs/bin:$PATH
export PATH
Step 3: Selecting Node.js Version
If you have multiple versions of Node.js installed, you can select a specific version to use during your session with the following command:
alternatives --config node
You should get a prompt like the prompt shown in the following screenshot. Enter the number corresponding to the Node.js version option you would like to use and press Enter.Â
The previous way of doing this (by using 'nodever list') is deprecated and has been replaced with 'update-alternatives'. While 'nodever' should still work properly if installed, we recommend using the new 'update-alternatives' method instead. There's more information about 'update-alternatives' here: https://techchannel.com/SMB/05/2020/update-alternatives.Â
Step 4: Checking the Version of Node.js
The following command can be used to verify that Node.js is running properly and that the installed or selected version is currently in use:
This should produce output that shows the version currently in use, as shown in the following screenshot:
Should you experience any errors when running a particular command, please make sure all of the preceding steps have been completed. Depending on how you start your PASE environment, you may have to set the PATH and select your version each time.