the-east.net
  • Home
  • Privacy Policy
  • Contact Us
  • Guest Post – Write For Us
  • Sitemap
the-east.net

How to Install Node.js in Ubuntu 20.04/22.04

  • Jeffery Williams
  • April 9, 2022
Total
0
Shares
0
0
0

Node.js is one of the most popular open source development platform that powers many web applications. With Node, developers can create server-side code; because it’s an asynchronous and event driven environment, you don’t have to worry about blocking your scripts while they’re running on your servers.

Node.JS is a backend Javascript runtime environment based on Google’s V8 engine that is open-source. It’s an asynchronous event-driven Javascript runtime environment designed to help you create fast and scalable network apps and backend API services.

There are three methods for installing Node.JS on Ubuntu, and we’ll go through each one in detail.

Method 1: Use the Ubuntu Repository to install Node.JS and NPM.

Start by modifying the package lists to install Node.JS and NPM from the Ubuntu repository:

sudo apt-get update

Then, as follows, install Node.JS and NPM from the Ubuntu repository using the apt package manager.

$ sudo apt install nodejs npm -y Install NodeJS from Ubuntu RepositoryInstall NodeJS from Ubuntu Repository

The most recent version of Node.JS available from the default Ubuntu repository is v10.19.0 at the time of writing this article. Run the following command to validate this:

$ nodejs -v OR $ nodejs –version Check NodeJS VersionCheck NodeJS Version

Method 2: Use the Nodesource Repository to install Node.JS and NPM.

Installing Node.JS and NPM from NodeSource, which is targeted at helping enterprises run mission-critical Node.JS applications with an emphasis on speed and resource efficiency, is an alternative method.

Begin by downloading and running the Script for installing Nodesource as instructed.

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

The script adds a Nodesource signing key to the sources list file, establishes a Nodesource repository, and updates the apt cache.

Nodesource Repository may be downloaded.Nodesource Repository may be downloaded.

Additional information on how to continue will be provided in the output.

Script for installing NodesourceScript for installing Nodesource

Run the following command to install NodeJS:

apt install nodejs -y $ sudo apt install nodejs -y

Both nodejs and npm binaries are included in the NodeJS package.

NodeJS may be downloaded at Nodesource.NodeJS may be downloaded at Nodesource.

Run the following command to see whether Node.JS is installed:

—version node

Run the following command to install npm:

$ npm –version Confirm NodeJS VersionConfirm NodeJS Version

Method 2: Using NVM, install Node.JS and NPM.

NVM (Node Version Manager) is a shell script that allows users to manage different Node.JS versions on a per-user basis. You may install, remove, and specify a certain Node.JS version as the default version using NVM.

Run the following command to get the NVM script:

$ curl nvm/master/install.sh | bash https://raw.githubusercontent.com/creationix/nvm/master/install.sh

The result will tell you that you need to reopen your terminal to use nvm towards the conclusion. So, to start performing nvm commands, shut your terminal and reopen it.

NVM Script may be downloaded.NVM Script may be downloaded.

You may check the version of nvm that is installed by running the following command:

$ nvm –version Check NVM VersionCheck NVM Version

Run the command to get a list of all the Node.JS versions that may be installed:

$ nvm list-remote List NodeJS VersionsList NodeJS Versions

The result lists all of the versions of Node.JS that may be installed, including the LTS versions. At the time of writing, the most recent LTS version is v16.14.2.

Versions of NodeJS with Long-Term SupportVersions of NodeJS with Long-Term Support

Run the following command to install the latest LTS version of Node.JS:

—lts nvm install

Just to be sure you have the most recent LTS version installed, use the command:

—version node Install NodeJS Using NVMInstall NodeJS Using NVM

Run the following command to install a particular version of Node.JS, such as 17.7.2:

$ nvm install 17.7.2 Install NodeJS Specific VersionInstall NodeJS Specific Version

Run the following command to get a list of all the Node.JS versions installed on your system:

$ nvm ls List NodeJS Installed VersionsList NodeJS Installed Versions

To switch to a different version of Node.JS, such as 16.14.2, use the command:

$ nvm use 16.14.2 Change NodeJS VersionChange NodeJS Version

Run the following command to make Node.JS the default version.

$ alias 16.14.2 nvm

That’s all there is to it. We looked at three different methods for installing Node.JS and npm on your PC. The newest version of Node.JS is not available from the Ubuntu repository.

Installing from Nodesource and NVM is suggested for getting the most recent version. The NVM installation technique also allows you to choose the version of Node.JS to designate as default for your environment and install your favorite version of Node.JS.

Frequently Asked Questions

How do I install Nodejs on Ubuntu?

A: The official site for Nodejs is https://nodejs.org/en/. If you want to install it, go ahead and follow their installation instructions.

Can you install node with NPM?

A: Yes, you can install node with NPM by running the following command in your terminal.

How do I download Nodejs 16?

A: The best way to download Nodejs 16 is by using the terminal. For this, you would need to open up your command prompt or terminal application and type in node . Once it starts downloading from their website, it will be added into your directory where ever you have downloaded/copied Nodejs before.

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Jeffery Williams

Previous Article

Russian Tech Spending Declines as Sanctions Take Toll

  • Jeffery Williams
  • April 9, 2022
View Post
Next Article

Ketanji Brown Jackson’s confirmation hearing Day 3

  • Jeffery Williams
  • April 9, 2022
View Post
Table of Contents
  1. Method 1: Use the Ubuntu Repository to install Node.JS and NPM.
  2. Method 2: Use the Nodesource Repository to install Node.JS and NPM.
  3. Method 2: Using NVM, install Node.JS and NPM.
  4. Frequently Asked Questions
    1. How do I install Nodejs on Ubuntu?
    2. Can you install node with NPM?
    3. How do I download Nodejs 16?
Featured
  • 1
    Chelsea: Todd Boehly set to be preferred bidder despite late offer from Sir Jim Ratcliffe
    • April 30, 2022
  • 2
    Live Grades for Charles Cross and Every Other Seattle Seahawks Pick
    • April 29, 2022
  • 3
    Tyson Fury
    • April 26, 2022
  • 4
    Gavin Newsom’s Disney Double Talk
    • April 26, 2022
  • 5
    How to Make a Shortcut on Snapchat?
    • April 25, 2022
Must Read
  • 1
    REI, Target and Amazon Beauty: Best online sales right now
  • 2
    Download Lodefast Check Cashing App for PC Windows 10,8,7
  • 3
    Download My Nymeo Mobile for PC Windows 10,8,7
the-east.net
  • Home
  • Privacy Policy
  • Contact Us
  • Guest Post – Write For Us
  • Sitemap
Stay Updated Always.

Input your search keywords and press Enter.