node Archives - The Linux GURUS https://thelinuxgurus.com/tag/node/ Learn Linux & DevOPS from THE LINUX GURUS Tue, 21 Apr 2020 14:39:36 +0000 en-US hourly 1 https://i0.wp.com/thelinuxgurus.com/wp-content/uploads/2020/01/cropped-thelinuxgurus_transparent_name.png?fit=32%2C32&ssl=1 node Archives - The Linux GURUS https://thelinuxgurus.com/tag/node/ 32 32 148921671 Install NVM on Ubuntu & use multiple version of NodeJS on Ubuntu https://thelinuxgurus.com/install-nvm-on-ubuntu-use-multiple-version-of-nodejs-on-ubuntu/ https://thelinuxgurus.com/install-nvm-on-ubuntu-use-multiple-version-of-nodejs-on-ubuntu/#respond Tue, 21 Apr 2020 14:39:36 +0000 https://thelinuxgurus.com/?p=1158 We have discussed how to install NodeJS on Ubuntu systems in our earlier tutorial, but that way we can only use a single installed version...

The post Install NVM on Ubuntu & use multiple version of NodeJS on Ubuntu appeared first on The Linux GURUS.

]]>
We have discussed how to install NodeJS on Ubuntu systems in our earlier tutorial, but that way we can only use a single installed version of nodejs on our system. What if we want to use another nodejs version, then what should we do ??

We can install NVM on the Ubuntu system. NVM stands for Node Version Manager is used for managing multiple versions of nodejs on a single system by controlling the nodejs versions installed on the system, also it can be used to install nodejs on the system. Basically, it is a command-line utility that allows us to switch between installed multiple nodejs versions.

Recommended Read: Simple way to install ADB & FastBoot on Ubuntu

Also Read: Install SNAP on Ubuntu & CentOS/RHEL

Currently, it supports Linux & MAC operating systems & doesn’t support Windows but there are some 3rd party tools for Windows that can be used for the same purpose. To install NVM on the Ubuntu system, we can use an install script maintained on GitHub. This will install NVM on Ubuntu as well as CentOS/RHEL/Debian systems as well. So let’s discuss the installation procedure for the same.


Install NVM on Ubuntu


First, we need to download the latest install script for NVM, use the following command to download the latest script from Github,

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

This command will not only download the script but will execute it as well. Once the script finishes, we can either close terminal & open a new session or we can source the ‘~/.bash_profile’ as some new paths for NVM would be added.

$ source ~/.bashrc


Manage NodeJS versions

Once we have nvm installed on our system, we can check the following commands to manage the installed nodejs versions.

1- List all available

To get the list of all available versions that can be installed our system, we will use the following command,

$ nvm list-remote

We will then get list of all the available versions with complete version numbers.


2- Install nodeJs version

To install a nodejs version, we can copy the version number that we got from the above-mentioned command & to install it use,

$ nvm install v0.12.18

We will then install another version also,

$ nvm install v8.1.3


3- List all installed NodeJs versions on the system

To get the list of all the nodejs versions installed on our system, we can use the following command,

$ nvm list


4- Set default nodejs version

To set a default nodejs version for the system, execute the following command,

$ nvm alias v8.1.3


5- Switch to different NodeJs version

To switch to another installed nodejs version, the command is

$ nvm use v0.12.18


6- Uninstall an installed NodeJS version

To uninstall an installed nodejs version, execute the following command,

$ nvm uninstall v8.1.3

This completes our tutorial on how to install NVM on Ubuntu & use it to manage the multiple nodejs versions on a single system. Please do let us know, if you face any issues or have questions, you can contact us using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Install NVM on Ubuntu & use multiple version of NodeJS on Ubuntu appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/install-nvm-on-ubuntu-use-multiple-version-of-nodejs-on-ubuntu/feed/ 0 1158
Complete guide to install NodeJS on Ubuntu https://thelinuxgurus.com/complete-guide-to-install-nodejs-on-ubuntu/ https://thelinuxgurus.com/complete-guide-to-install-nodejs-on-ubuntu/#respond Mon, 13 Apr 2020 16:38:59 +0000 https://thelinuxgurus.com/?p=1142 NodeJS is a JavaScript platform built on Chrome’s JS Runtime created for general-purpose programming that allows for the creation of applications in a fast &...

The post Complete guide to install NodeJS on Ubuntu appeared first on The Linux GURUS.

]]>
NodeJS is a JavaScript platform built on Chrome’s JS Runtime created for general-purpose programming that allows for the creation of applications in a fast & efficient manner. We can run nodejs applications as standalone applications on our machine. NodeJs is used for creating full-stack applications, front-end applications but its mainly used for creating the backend applications. It is very light-weight applications as it uses an event-driven model.

Recommended Read: Introduction to Bash Scripting Tutorial

Also Read: Recommended guide to install POSTGRESQL from Source

In order to install NodeJs on Ubuntu, we must install it from nodesource. This will also install NPM on Ubuntu. NPM is the default package manager for the nodejs. NPM maintains the largest repository of packages for NodeJS.


Install NodeJS on Ubuntu/ Install NPM on Ubuntu


As mentioned above, we need to add the nodesource repository to the system first. To add the repository, use the following command,

$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash –

This will install the version with LTS support but if you need to install the latest nodejs version, then use the following command,

$ curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash –

NOTE: If ‘curl’ is not installed on the system, install it using the following command,

$ sudo apt-get install curl

Once the repository has been added, we can install nodejs on Ubuntu system with the following command,

$ sudo apt-get update

$ sudo apt-get install nodejs

As mentioned above also, this command will also install NPM on Ubuntu systems. Now we can confirm the installed versions for both NodeJS & NPM with the following commands,

$ npm -v

$ node -v

That’s it, this was our tutorial on how to install NodeJS on Ubuntu (& also npm on Ubuntu systems). We can now use the installed nodejs to create our applications. In our future tutorial, we will discuss how to install & maintain multiple versions of NodeJs on a single system using the NVM aka Node Version Manager. For this tutorial, you can leave your comments or questions using the comment box below.

If you think we have helped you or just want to support us, please consider these:-

Connect to us: Facebook | Twitter | Linkedin

TheLinuxGURUS are thankful for your continued support.

The post Complete guide to install NodeJS on Ubuntu appeared first on The Linux GURUS.

]]>
https://thelinuxgurus.com/complete-guide-to-install-nodejs-on-ubuntu/feed/ 0 1142