• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to install Node.js on Ubuntu 22.04

  • 00:41 lsb_release -a
  • 00:57 apt update
  • 01:26 apt install nodejs -y
  • 01:56 node -v
  • 02:17 apt remove nodejs
  • 02:38 apt purge nodejs
  • 02:53 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  • 03:13 source ~/.bashrc
  • 03:27 nvm list-remote
  • 04:11 nvm install v22.4.1
  • 04:32 node -v
7886

To Install Node.js On Ubuntu 22.04

Introduction:

Node.js is a runtime environment for executing server-side JavaScript code. It enables developers to build robust backend systems using the widely popular JavaScript programming language, commonly used in web development for browser-based applications.

Procedure :

Step 1: Check the OS version by using the below command

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy

Step 2: Update the repository by using below command

root@linuxhelp:~# apt update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:2 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:4 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [497 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1,583 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Get:7 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [269 kB]
Get:8 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [43.2 kB]
Get:9 http://security.ubuntu.com/ubuntu jammy-security/main DEP-11 48x48 Icons [16.9 kB]
Fetched 16.0 MB in 7s (2,309 kB/s)                                                                                                        
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
334 packages can be upgraded. Run 'apt list --upgradable' to see them.

Step 3: Now install Nodejs using apt command

root@linuxhelp:~# apt install nodejs -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libflashrom1 libftdi1-2 libllvm13
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  javascript-common libc-ares2 libjs-highlight.js libnode72 nodejs-doc
Suggested packages:
  apache2 | lighttpd | httpd npm
The following NEW packages will be installed:
  javascript-common libc-ares2 libjs-highlight.js libnode72 nodejs nodejs-doc
0 upgraded, 6 newly installed, 0 to remove and 334 not upgraded.
Need to get 13.7 MB of archives.
After this operation, 54.0 MB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu jammy/main amd64 javascript-common all 11+nmu1 [5,936 B]
Get:2 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 libjs-highlight.js all 9.18.5+dfsg1-1 [367 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libc-ares2 amd64 1.18.1-1ubuntu0.22.04.3 [45.1 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libnode72 amd64 12.22.9~dfsg-1ubuntu3.6 [10.8 MB]
Get:5 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 nodejs-doc all 12.22.9~dfsg-1ubuntu3.6 [2,411 kB]
Unpacking nodejs (12.22.9~dfsg-1ubuntu3.6) ...
Setting up javascript-common (11+nmu1) ...
Setting up libc-ares2:amd64 (1.18.1-1ubuntu0.22.04.3) ...
Setting up nodejs-doc (12.22.9~dfsg-1ubuntu3.6) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...

Step 4: Now check the node version by using below command

root@linuxhelp:~# node -v
v12.22.9

Step 5: Then uninstall node by using apt command

root@linuxhelp:~# apt remove nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  javascript-common libc-ares2 libflashrom1 libftdi1-2 libjs-highlight.js libllvm13 libnode72 nodejs-doc
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  nodejs
0 upgraded, 0 newly installed, 1 to remove and 334 not upgraded.
After this operation, 929 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 202702 files and directories currently installed.)
Removing nodejs (12.22.9~dfsg-1ubuntu3.6) ...
Processing triggers for man-db (2.10.2-1) ...

Step 6: Now remove the configuration files by using below command

root@linuxhelp:~# apt purge nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'nodejs' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  javascript-common libc-ares2 libflashrom1 libftdi1-2 libjs-highlight.js libllvm13 libnode72 nodejs-doc
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 334 not upgraded.

Step 7: Install nodejs with Node Version Manager. For that download and run the following script using curl command.

root@linuxhelp:~# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15037  100 15037    0     0  69028      0 --:--:-- --:--:-- --:--:-- 69615
=> Downloading nvm as script to '/root/.nvm'

=> Appending nvm source string to /root/.bashrc
=> Appending bash_completion source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Step – 8 : The script will install the nvm script to your user account. To use it, you must first source your .bashrc file.

root@linuxhelp:~# source ~/.bashrc

Step 9: Use the following command to list the versions

root@linuxhelp:~# nvm list-remote
        v0.1.14
        v0.1.15
        v0.1.16
        v0.1.17
        v0.1.18
        v0.1.19
        v0.1.20
        v0.1.21
        v0.1.22
        v0.1.23
        v0.1.24
        v0.1.25
        v0.1.26
        v0.1.27
        v0.1.28
        v0.1.29
        v0.1.30
        v0.1.31
        v0.1.32
        v21.6.0
        v21.6.1
        v21.6.2
        v21.7.0
        v21.7.1
        v21.7.2
        v21.7.3
        v22.0.0
        v22.1.0
        v22.2.0
        v22.3.0
        v22.4.0
        v22.4.1

Step 10: Now install nodejs with specific version using nvm command

root@linuxhelp:~# nvm install v22.4.1
Downloading and installing node v22.4.1...
Downloading https://nodejs.org/dist/v22.4.1/node-v22.4.1-linux-x64.tar.xz...
#################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v22.4.1 (npm v10.8.1)
Creating default alias: default -> v22.4.1

Step 11:After installation completed, check the version using below command

root@linuxhelp:~# node -v
v22.4.1

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to installation of nodejs on Ubuntu 22.04. Your feedback is much welcome.

Tags:
grayson
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What are the functionalities of NPM in Node.js?

A

NPM (Node Package Manager) provides two functionalities:
-Online repository for Node.js packages.
-Command line utility for installing packages, version management, and dependency management of Node.js packages.

Q

What is the difference between Node.js and Ajax?

A

Node.js and Ajax (Asynchronous JavaScript and XML) are the advanced implementations of JavaScript. They all serve completely different purposes.
Ajax is primarily designed for dynamically updating a particular section of a page’s content, without having to update the entire page.
Node.js is used for developing client-server applications.

Q

What are the features of Node.js?

A

Node.js is a single-threaded but highly scalable system that utilizes JavaScript as its scripting language.

Q

Where can you use the Node.js?

A

Node.js is used to build scalable programs especially web applications which are computationally simple but are frequently accessed.

Q

What is Node.js?

A

Node.js is a server-side scripting based on Google’s V8 JavaScript engine.

Related Tutorials in How to install Node.js on Ubuntu 22.04

Related Tutorials in How to install Node.js on Ubuntu 22.04

How to install Meld tool in Ubuntu
How to install Meld tool in Ubuntu
Feb 25, 2017
How to install Dconf-Editor on Ubuntu 18.04
How to install Dconf-Editor on Ubuntu 18.04
Jul 14, 2018
How to install and update OpenSSL on Ubuntu 16.04
How to install and update OpenSSL on Ubuntu 16.04
Mar 9, 2017
How to install GLib 2.0 on Ubuntu 17.04
How to install GLib 2.0 on Ubuntu 17.04
May 22, 2017
How to Install Android Emulator on Ubuntu 20.4.1
How to Install Android Emulator on Ubuntu 20.4.1
Jul 13, 2021
How To Install AnyDesk on Ubuntu 16.04
How To Install AnyDesk on Ubuntu 16.04
Apr 4, 2018
How to install Genymotion 2.12.1 on Ubuntu 18.04
How to install Genymotion 2.12.1 on Ubuntu 18.04
Jul 9, 2018
How to install Timeshift 18.4 on Ubuntu 18.04
How to install Timeshift 18.4 on Ubuntu 18.04
Jul 6, 2018

Related Forums in How to install Node.js on Ubuntu 22.04

Related Forums in How to install Node.js on Ubuntu 22.04

Ubuntu
matthew class=
Failed to enable unit: Refusing to operate on linked unit file sshd.service
Apr 15, 2019
Ubuntu
mason class=
Passwd: You may not view or modify password information for root On Ubuntu 19.04
May 27, 2019
Ubuntu
isaac class=
/etc/apt/sources.list Permission denied
May 18, 2017
Ubuntu
yousuf class=
lsb_release command not working : Debian
Jan 18, 2018
ifconfig command
jackbrookes class=
what is the location of the ifconfig program on your machine?
Jan 4, 2018
Ubuntu
mason class=
"E: Package 'php-mcrypt' has no installation candidate" error on Ubuntu 20.4.1
Mar 15, 2021
NFS
luke class=
clnt_create: RPC: Program not registered
Apr 25, 2017
Apache
isaac class=
How to disable apache welcome page on Ubuntu
Dec 15, 2018

Related News in How to install Node.js on Ubuntu 22.04

Related News in How to install Node.js on Ubuntu 22.04

How To Install Mixxx on Ubuntu 16.04
How To Install Mixxx on Ubuntu 16.04
Oct 11, 2017
Ubuntu 17.04 released with greater expectations
Ubuntu 17.04 released with greater expectations
Apr 15, 2017
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Mar 1, 2017
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Ubuntu 17.10 Artful Aardvark Beta 1 is now here. Download Now
Sep 2, 2017
Docker friendly Alpine Linux gets hardened Node.js
Docker friendly Alpine Linux gets hardened Node.js
Apr 19, 2017
Ubuntu Unity is no more: One Linux dream has been axed
Ubuntu Unity is no more: One Linux dream has been axed
Apr 7, 2017
What’s next for Ubuntu Linux Desktop?
What’s next for Ubuntu Linux Desktop?
Apr 11, 2017
Say Hi to Ubuntu's new mascot
Say Hi to Ubuntu's new mascot
Mar 22, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.