Troubleshooting
Problem
Multiple versions of Node.js are available for IBM i via RPM. This document discusses how to manage multiple versions.
Resolving The Problem
Node.js RPMs leverage a utility called "nodever" to help you manage
To switch the default version of Node.js for all users using update-alternatives
Automatically use the newest installed version
alternatives --auto node
List available versions of node to select from
alternatives --config node
Set the effective version
alternatives --set node /QOpenSys/pkgs/lib/nodejs<version>/bin/node
For instance, to set the effective version to Node version 16
To switch the default version of Node.js for a specific user
Place /QOpenSys/pkgs/lib/nodejs<version>/bin
at the beginning of the user’s PATH environment variable, similar to what’s documented here. For instance, that user could run the following from the shell to set their default to version 16:
echo 'PATH=/QOpenSys/pkgs/lib/nodejs16/bin:/QOpenSys/pkgs/bin:$PATH' >> $HOME/.profile
echo 'export PATH' >> $HOME/.profile
(if using bash
as the shell, the user may need to run hash -r
)
To explicitly invoke a specific version without the previously-documented environment setup
/QOpenSys/pkgs/lib/nodejs<version>/bin/node
For instance:
/QOpenSys/pkgs/lib/nodejs16/bin/node
[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.1.0"}]
Was this topic helpful?
Document Information
Modified date:
23 April 2021
UID
nas8N1021671