How to Install Node.js on Debian 11 Server. There are multiple programming languages available online that developers can use to build a web application. But it is recommended to select the right tool to execute a better project. Today, many developers consider the Node.js framework. It is a server side programming and a runtime environment, based on Chrome’s V8 JavaScript engine.
Node.js framework is more versatile and supports both front end and back end coding and there are many advantages to choosing it . Here, we will discuss the Node.js framework in detail and its benefits.
In this tutorial we will show you 3 methods for installing Nodejs on Debian 11: Install Node.js from Debian Repository, from NodeSource and install Node.js with NVM. We believe in showing multiple methods of installing Node.js as it will be beneficial for any user.
What is Node.js framework
Released in 2009 by Ryan Dahl, Node.js is a free, open source platform designed to aid developers in creating fast and dynamic web pages and network applications.
Node.js is highly compatible with OS X, Linux, and Microsoft Windows platforms. Its framework is a platform that helps developers use JavaScript to write front end and back end coding and command line tools.
The framework is a collection of libraries and tools built on Node, including:
Express.js – It is an asynchronous Model View Controller framework with high speed I/O that helps direct servers and routes, renders HTML Pages, and enables developers to design different web applications.
AdonisJS – It is a Node.js framework with an MVC like structure that involves less use of code when writing web applications, runs multiple test modules, and focuses on being a stable framework.
MeteorJS – An open source Node.js web framework that produces cross platform codes and supports other frameworks.
NestJS – Another Node.js framework that helps the developer in building efficient server side applications. It supports JavaScript, Object Oriented Programming (OOP), TypeScript, etc.
SailsJS – It is an MVC based framework that uses Node.js as a base. The framework is supported to ease the building process of customized web applications and API.
Hapi.js, Loopback.io, Feathers.js, MEAN.JS, and KoaJS are a few other Node.js Frameworks.
Follow this post to learn how to Install Node.js on Debian 11 Server.
Here are a few advantages of using Node.js framework:
Fast-processing and event based model (V8 engine with Non blocking Input/Output and asynchronous request handling).
Easy to Learn and Scalable – Node.js framework uses JavaScript to write codes which is one of the popular programming languages, and most developers find it easy to work on it. One can learn Node.js in a short time. Also, it offers high scalability and ensures that the servers are processing requests seamlessly.
Fullstack JS Benefit – Node.js serves both clients and server side applications, making it a full stack JavaScript. As a result, you do not require additional developers to perform backend and front end developments separately. You can save both time and money using the Node.js frameworks.
Offers High Performance – Node.js uses Google’s V8 JavaScript engine to interpret the JavaScript code directly into the machine code. Thus, making the process of code implementation easier, faster, and more effective. The code execution speed is also enhanced as most frameworks support non blocking I/O operations.
Manages Requests Simultaneously – Node.js supports non blocking I/O systems, which help developers to process multiple requests at the same time. Compared to other languages like Ruby or Python, Node.js handles concurrent requests more efficiently. All the incoming requests are executed in a systematic manner and quickly.
JSON support if you need to build for example RESTful APIs for NoSQL database like MongoDB, this seamless communication with one of the main data transfer standards is another advantage of the JavaScript ecosystem as Node.js does it without converting between binary models and uses JavaScript.
Next in this post is how to install Node.js on Debian 11.
The simple and easiest way to install Node.js is to install it from the Debian default repository. The latest version included in the Debian 11 repository is 12.22.5.
You can check the available Node.js version using the following command:
apt show nodejs
You will get the package information in the following output:
Package: nodejs
Version: 12.22.5~dfsg-2~11u1
Priority: optional
Section: web
Maintainer: Debian Javascript Maintainers
Installed-Size: 940 kB
Provides: node-types-node (= 12.20.19~12.22.5~dfsg-2~11u1)
Depends: libc6 (>= 2.2.5), libnode72 (= 12.22.5~dfsg-2~11u1)
Recommends: ca-certificates, nodejs-doc
Suggests: npm
Conflicts: nodejs-legacy
Breaks: node-babel-runtime (<< 7), node-typescript-types (<< 20210110~)
Replaces: nodejs-legacy
Homepage: https://nodejs.org/
Tag: devel::interpreter, devel::lang:ecmascript, devel::runtime, devel::web,
implemented-in::c++, implemented-in::ecmascript,
interface::commandline, interface::shell, protocol::dns,
protocol::http, protocol::tcp, role::program, scope::application,
works-with-format::json
Download-Size: 147 kB
APT-Sources: http://debian.gtisc.gatech.edu/debian bullseye/main amd64 Packages
Description: evented I/O for V8 javascript - runtime executable
Node.js is a platform built on Chrome's JavaScript runtime for easily
building fast, scalable network applications. Node.js uses an
event-driven, non-blocking I/O model that makes it lightweight and
efficient, perfect for data-intensive real-time applications that run
across distributed devices.
Next, update the Debian 11 repository by running the following command:
apt-get update -y
Once the repository is up to date, you can install the Node.js and NPM package using the following command:
apt-get install nodejs npm -y
After the successful installation, verify the Node.js version using the following command:
node --version
You will get the following output:
v12.22.5
If you want to uninstall the Node.js package from your system, run the following commands:
The NodeSource is an online repository that contains open source Node.js packages. It helps developers to install multiple Node.js versions in the same server.
First, install the curl command line utility using the following command:
apt-get install curl -y
Next, add the NodeSource repository for Node.js version 17 using the following command:
apt-get install nodejs -y
After the installation, verify the Node.js version with the following command:
NVM stands for “Node Version Manager” is a Node package manager that allows you to install, manage and switch between different Node versions with ease. It provides a command line interface to install and manage different Node.js versions.
First, run the following command to install the NVM:
/usr/lib
├── corepack@0.10.0
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:
$ nvm use system
$ npm uninstall -g a_module
=> 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
Once the NVM is installed, close and reopen your terminal to start using nvm or run the following to use it now:
How to Install Node.js on Debian 11 Server Conclusion
NodeJs makes the web application development more integrated through JavaScript usage on both the front and back end development as it is JavaScript framework that allows users to easily develop autonomous network applications for general purpose programming.
In the above guide, we learned three different ways to install Node.js on Debian 11. You can now choose your preferred ways to install Node.js on your server. For more information, visit the Node.js documentation page.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.