Warning | ||
---|---|---|
| ||
Info | ||
---|---|---|
| ||
Documentation by IBM on how to install the yum opensource package manager to an IBM i can be found here. |
Installing Node.js with yum Package Manager
If yum is properly set up on your system, you can install Node.js by running the following command in a PASE shell:
Code Block |
---|
yum install nodejs14nodejs20 |
If you would like to install a different version of Node.js, you can simply replace nodejs14 with nodejs20 with the correct version in the command.
...
For example, if NPM shows a message like below, DO NOT follow the steps given to update NPM:
Info | ||
---|---|---|
| ||
If you accidentally changed the version of NPM from that installed by yum, re-install Node.js to set NPM back to normal. For example, to re-install Node.js 14 w/NPM 6: |
Node.js on IBM i
Node.js on IBM i is installed in locations like this:
/QOpenSys/pkgs/lib/nodejs14/bin
/QOpenSys/pkgs/lib/nodejs16/bin
/QOpenSys/pkgs/lib/nodejs18/bin
The system-wide default version is a symlink here, which points to one of the above:
/QOpenSys/pkgs/bin/node
Setting System-wide Default
This command is used to select the system-wide default version of Node.js, which sets the above symlink:
Code Block |
---|
alternatives --config node |
Setting Default Version for a User
To select an alternate version of Node.js, users can simply prepend one of the above 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:
Code Block |
---|
export PATH=/QOpenSys/pkgs/lib/nodejs18/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 Default Version for a Profound.js / PAPI Instance
Instances on IBM i started with STRTCPSVR normally use the system-wide default version of Node.js. This can be overridden using the nodePath directive in the instance configuration file, as documented here.
Changes that Need to be Made When Upgrading
Be sure to update the following when you have completed upgrading to a different Node.js version: