6

Plesk Onyx supports Node.js. My Node.js Manager (from the Plesk extensions) currently supports two nodejs Versions.

Installing a new version with the centos package manager yum did not change anything.

Copying one of the versions, that are installed and putting them to a new folder e.g. 4/ in the directory structure used by the Node.js Manager also did not lead to results.

I need the version Node 4.6.2 for Meteor 1.4.x applications.

Thank you.

enter image description here

Jakob Alexander Eichler
  • 2,988
  • 3
  • 33
  • 49
  • Onfortunately here I do not find any information about the make a new version available on the server https://docs.plesk.com/en-US/onyx/administrator-guide/76658/ – Jakob Alexander Eichler May 23 '17 at 10:19
  • I now tried approch 1 from this question: https://talk.plesk.com/threads/how-do-i-activate-offer-additional-nodejs-versions.341286/ But it did not help yet. – Jakob Alexander Eichler May 23 '17 at 10:43
  • Maybe this somehow helps: https://docs.plesk.com/en-US/onyx/cli-linux/using-command-line-utilities/nodejs-nodejs-versions.77392/ – Jakob Alexander Eichler May 23 '17 at 11:27
  • This tutorial recommend to "Select the desired Node.js version under the "Node.js" component", but there are non chooseable... https://docs.plesk.com/en-US/onyx/administrator-guide/plesk-administration/using-nodejs.76658/ – Jakob Alexander Eichler May 23 '17 at 11:40

5 Answers5

22

Enable Node support in Plesk Onyx:

  1. Install the "Node support" simply from your "update and updates" Plesk interface.
  2. Go to your "Node extension" page enable/disable the node versions you need

In case you need additional node versions which does not come with the default node support installation:

  1. Install the Node Version Manager on your server
  2. Install the versions you need e.g. nvm install v4.8.4
  3. Copy paste the node version to plesk cp -R ~/.nvm/versions/node/v4.8.4/ /opt/plesk/node/
  4. Then notify your plesk about your installation plesk sbin nodemng register /opt/plesk/node/v4.8.4/bin/node
  5. Go to your node extension page where all node versions are listed, hit refresh and voilá

If you have troubles installing the NPM packages through Plesk do it within the SSH shell with the dedicated node version you need for meteor.

  1. nvm use 4.8.4
  2. cd /bundle/programs/server
  3. npm install
  4. Go to the Plesk GUI, select your domain, click on node.js
  5. Configure your app and run it

Opened a dedicated thread for this to help people finding it.

Install additional node versions in Plesk Onyx

Maertz
  • 4,952
  • 2
  • 18
  • 27
  • 1
    I've done that, now I get an error when using the new version. And try to run install node package (NPM install) from PLESK Installing the application dependencies. /usr/bin/env: 'node': No such file or directory I suspect, that I need to update plesk's bash profile... how can I do that or what did I miss? – Sam Mar 18 '19 at 16:45
  • Was looking for this for so long... Plesk support doesn't have this info – Tofandel Apr 28 '20 at 12:46
  • @Sam Check the answer to this question for a fix: https://stackoverflow.com/questions/46755352/install-additional-node-versions-in-plesk-onyx/65938463#65938463 – Milkmannetje Jan 28 '21 at 13:54
  • I was able to run nodejs script from php: `exec("/opt/plesk/node/14/bin/node app.js",$out,$err);` using this guide. Thanks! – Alex Szücs Aug 30 '21 at 13:31
  • I had to use `plesk ext nodejs register ...`. Seems as if this has changed in newer versions of Plesk (using Plesk Obsidian Version 18.0.39). – Dev Ze Oct 26 '21 at 10:45
6

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

node version list

Tofandel
  • 3,006
  • 1
  • 29
  • 48
1

For those who get the error:

"/usr/bin/env: 'node': No such file or directory"

after following the solution from Maertz:

Open

/opt/plesk/node/YOURVERSION/lib/node_modules/npm/bin/npm-cli.js

and change the first line to

#!/opt/plesk/node/YOURVERSION/bin/node
swiss_knight
  • 5,787
  • 8
  • 50
  • 92
0

I failed to add a random version which I manually downloaded to my plesk environment.

But with searching with yum (yum search keyword) for package names, that included node I was able to find: "plesk-nodejs4.x86_64"

Installing it solved the issues and the version 4.6.2 appears in the Node.js manager of plesk now.

Jakob Alexander Eichler
  • 2,988
  • 3
  • 33
  • 49
0
apt-get install npm
npm install -g n
export N=13
export N_PREFIX=/opt/plesk/node/$N && n $N && plesk sbin nodemng register $N_PREFIX/bin/node

This alone will not do the job, we have to backup and change the symlinks as well.

Backing Up the Existing Symlinks

mv /usr/bin/nodejs /usr/bin/node.backup 
mv /usr/bin/node /usr/bin/node.backup 
mv /usr/bin/npx /usr/bin/npx.backup 
mv /usr/bin/npm /usr/bin/npm.backup

Creating the new Symlinks

ln -s /opt/plesk/node/N/bin/node /usr/bin/node 
ln -s /opt/plesk/node/N/bin/node /usr/bin/nodejs 
ln -s /opt/plesk/node/N/bin/npx /usr/bin/npx 
ln -s /opt/plesk/node/N/bin/npm /usr/bin/npm
ToniLu
  • 11
  • 4