Installing Node.js for IBM i

Installing Node.js for IBM i

  1. See the installation guide to determine which versions of Node.js are supported by each Profound.js release.

  2. IBM i 7.3 or higher is required for installing Node.js on IBM i.

  3. The yum open source package manager is required for installing Node.js on IBM i.

Overview

Node.js on IBM i is delivered as an open source RPM package and is installed with the yum package manager. Multiple Node.js versions can co-exist on the same system, and Profound.js instances can each be pointed at a specific one.

Installing Node.js with the yum Package Manager

Don’t have yum? IBM’s documentation on installing the yum open source package manager onto an IBM i can be found here.

Profound.js is tested with the versions of Node Package Manager (npm) that install from the IBM yum repositories. The Node.js packages include a copy of npm that is updated when the Node.js yum package is updated. Do not manually update or change the npm version on the system, as this can result in installation problems.

If yum is properly set up on your system, install Node.js by running the following command in a PASE shell:

yum install nodejs22

To install a different version of Node.js, replace nodejs22 with the package name for the version you need – for example nodejs20. Install the most recent version supported by the Profound.js release you are installing (see Profound.js Prerequisites).

Multiple versions of Node.js can co-exist on the same IBM i system. For instructions on selecting the system default version, see Verify Node.js Environment on IBM i.

For example, if npm shows a message like the one below, do not follow the steps it gives to update npm:

Downgrading npm

If you accidentally changed the version of npm from the one installed by yum, re-install Node.js to set npm back to normal. For example, to re-install Node.js 22 with the npm version that ships with it:

yum reinstall nodejs22

If yum install cannot find the Node.js package at all, the system’s repository paths may be out of date (see Resolving IBM Repository Paths for YUM installer).

Node.js on IBM i

Each Node.js version is installed into its own directory:

/QOpenSys/pkgs/lib/nodejs20/bin /QOpenSys/pkgs/lib/nodejs22/bin

The system-wide default version is a symlink here, which points to one of the above:

/QOpenSys/pkgs/bin/node

Setting the System-wide Default

This command selects the system-wide default version of Node.js, which sets the symlink above:

alternatives --config node

Setting the Default Version for a User

To select an alternate version of Node.js, a user can prepend one of the version directories to the PATH environment variable. An easy way to do that is to add a line like this to the profile file at /home/USER_PROFILE/.profile:

export PATH=/QOpenSys/pkgs/lib/nodejs22/bin:$PATH

The commands in the profile file are executed when the shell starts, so the user must exit and log on to a new shell for this to take effect.

Setting the Default Version for a Profound.js / Profound API Instance

Instances on IBM i started with STRTCPSVR normally use the system-wide default version of Node.js. This can be overridden with the nodePath directive in the instance configuration file (see Starting and Ending Profound.js Instances):

nodePath=/QOpenSys/pkgs/lib/nodejs22/bin/node

Changes When Upgrading

After upgrading to a different Node.js version, be sure to update the following:


Related Pages