Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a new node.js version for the Node.js Manager on Plesk?

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

like image 895
Jakob Alexander Eichler Avatar asked May 23 '17 10:05

Jakob Alexander Eichler


People also ask

How do I update Plesk node js?

Log in to Plesk, go to “Tools and Settings”, and click “Updates and Upgrades”. Next, go to “Add/Remove Components”. Find the “NodeJS support” component. Select it, and continue with the Node.

How do I update NodeJs to a specific version?

Or if you want a specific version like I needed 8.0. 0 then you can do this using. node -v. If you want to switch to the different version of Node, just type n in the terminal and you should see the Node versions listed.

How do I install a specific version of node js?

How To Install A Specific Version Of A Package. You can use the npm install command to download and install a package on your development environment. By default, the npm install command fetches the latest available version of the specified package—in this case, it's Renovate version 24.52.


3 Answers

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

like image 63
Maertz Avatar answered Nov 15 '22 08:11

Maertz


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

like image 25
Tofandel Avatar answered Nov 15 '22 07:11

Tofandel


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
like image 31
TheFamousSpy Avatar answered Nov 15 '22 06:11

TheFamousSpy