To add to the already great answer by Maertz, here is an up to date simpler guide
You can use n
to manage your node installs and to do the installation in the correct directory
Assuming you want to install node 16 (because plesk only comes with v12), you can run
apt-get install npm
npm install -g n
export N=16
export N_PREFIX=/opt/plesk/node/$N && n $N && plesk sbin nodemng register $N_PREFIX/bin/node
If you want any other version, replace the N=16
with your major version number
For example for node 14:
export N=14
export N_PREFIX=/opt/plesk/node/$N && n $N && plesk sbin nodemng register $N_PREFIX/bin/node
Then go to yourpleskserverdomain.com:8443/modules/nodejs/index.php/index/refresh
to automatically refresh the list of available node version (If anyone finds the way to do this via CLI, feel free to comment)
And you're done
You may also rerun those commands to update the minor version of your already installed node major versions
nodemng
util of plesk has been removed, meaning it's not possible to install a custom handler anymore, but luckily they are now kept up to date – Alexalexa