Node.JS is a great language for developers to easily write many different types of applications, such as Discord bots, web panels, API endpoints, and so much more. With this guide you'll be able to install any version of Node.JS you need.

Installing Node Version Manager

Log into your dedicated server via SSH
Run the command curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash to install the latest version of NVM
It should give a number of commands as output, as seen here:
Copy and paste those commands back into the terminal and run them
Run nvm ls-remote to verify it's correctly installed. If this does not work, try logging out of the SSH and logging back in again

Installing a version of Node.JS

Firstly, you would need to know which version of Node.JS you wish to use. If you're not sure, just go to the Node.JS website and check what the latest "LTS" release is

Log into your dedicated server via SSH
Run the command nvm install AB.CD.XY, replacing AB.CD.XY with the version you wish to use
Run the command node --version to verify it's correctly installed

Running an application

Upload the Node.JS application to your dedicated server, either using something like WinSCP or by using git clone <github link> directly onto the machine
Run cd /folder/where/the/application/is to go to the right folder
Run npm install to install all of the application's dependencies
Run node . to start the application

Making an application automatically start on boot

Install Process Manager 2 globally by running npm install -g pm2
Allow PM2 to start on boot with pm2 startup
Start your application using PM2 by running pm2 start ./index.js --name MyApplication rather than node ./index.js
Run pm2 save so that PM2 will save a list of running apps to disk, so they can be re-opened on next boot
Test this by restarting the machine
Was this article helpful?
Cancel
Thank you!