Open In App

How to install and manage Node using NVM on Godaddy Server ?

Last Updated : 26 Aug, 2022
Like Article

GoDaddy VPS is a shared server that provides computational services, databases, storage space, automated weekly backups, and 99% uptime, and GoDaddy Server is a cloud-based hosting platform that consists of virtual and dedicated servers. 

The premium service includes weekly backups, 99% uptime, 24×7 Customer Support, a free encrypted SSL certificate, unlimited bandwidth, and SSD storage. For regular users, the latest generation is VPS Gen 4, which uses QEMU as the hypervisor to perform hardware virtualization. It offers a cheaper alternative to Amazon Web Service and Google Cloud Platform. 

The Node.js runtime environment is an open-source and cross-platform Javascript compiler that is built upon Chrome’s V8 JavaScript engine. We can use APT to install the latest LTS version of Node, but it may happen that we will require different versions of Node for specific projects. 

So, to install and manage different versions of Node, we will use Node Version Manager. NVM  is an open-source tool that allows you to download, configure, and run different versions of Node.js on the same machine.

In this article, we will discuss how to install the latest version of Node and NPM on GoDaddy VPS Gen 4 (Ubuntu).

Installing NVM:

Step 1:  Open your terminal by searching it in the application Menu and ssh into the Godaddy server.

$ ssh [username]@[ip]


Step 2: Update and upgrade the server by running.

$ sudo apt update -y
$ sudo apt upgrade -y


Step 3: Install the latest version of nvm by executing the required bash script.

$ curl -o- | bash


Step 4: Now, open the .bashrc file and append the path variables to the end of the file

$ nano ~/.bashrc

Step 5: Now, set the path for the NVM home directory by pasting the following at the end of the file.

export NVM_DIR=”$HOME/.nvm”

[ -s “$NVM_DIR/” ] && \. “$NVM_DIR/”  # This loads nvm

[ -s “$NVM_DIR/bash_completion” ] && \. “$NVM_DIR/bash_completion”  # This loads nvm bash_completion


Step 6: Commit the changes by reloading the .bashrc file.

$ source ~/.bashrc


Step 7: Verify if nvm has been installed on the server successfully

$ nvm --version


Installing Node and NPM:

Step 1: Install the latest version of node and npm by running

$ nvm install node


Step 2: Verify the installation by checking the build version of node and npm

$ node --version
$ npm --version


Managing Node versions:

Step 1: To install an older version of the node.

$ nvm install [version]


Step 2: To use the newly installed version.

$ nvm use [version]


Step 3: Set a specific version as default.

$ nvm alias default [version]


Step 4: Remove an existing version by running.

$ nvm uninstall [version]


Using Node JS:

To test the node compiler, create a Javascript program that outputs ‘Hello GFG’ using node. Now compile the JS file using node.

$ node filename.js


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads