What is Node.js

An open-source server-side runtime environment for JavaScript called Node.js enables you to execute JavaScript code on the server. It is made for creating scalable and effective network applications, and it is widely used to create web applications, APIs, and other server-side programs.

  1. JavaScript Runtime:- Node.js enables you to execute JavaScript code on the server, whereas JavaScript is typically associated with web browsers for client-side scripting.
  2. Single-Threaded:- Although Node.js applications are single-threaded, they may effectively manage several concurrent tasks by using callbacks and asynchronous activities. For some applications, this may lead to better performance.
  3. Event-Driven and Non-Blocking:- An event-driven, non-blocking I/O mechanism is the foundation of Node.js. This indicates that it can manage numerous connections simultaneously without delaying the execution of any code. Applications that demand a lot of concurrency and real-time communication are especially well suited for it.
  4. Package Manager (npm):- The npm (Node Package Manager) ecosystem of open-source libraries and modules that come with Node.js allows developers to expand the capabilities of the framework and make the process of creating applications more straightforward. ion.
  5. V8 JavaScript Engine:- The V8 JavaScript engine, created by Google and renowned for its great performance, is used by Node.js. V8 is quick and effective because JavaScript code is compiled into machine code. n.
  6. Cross-Platform:- Node.js is extremely portable since it supports many different operating systems, including Windows, macOS, and many Unix-like platforms.
  7. Large and Active Community:- A large number of resources, libraries, and tools are available for Node.js development because of the dynamic and active developer community that supports it.

The development of web servers and web applications, real-time applications like chat programs and online games, the creation of APIs, and the creation of command-line tools are just a few examples of common Node.js use cases. Its popularity has increased in part as a result of its adaptability in creating various applications and its ability to handle asynchronous I/O activities effectively.

install Node js

The Node.js official website provides a yum repository that must first be enabled on your system. Additionally, you require development tools to create native add-ons that may be installed on your system.

The default repositories of Rhel include a version of Node.js that can be used to deliver a consistent user experience across several platforms. Version 12.22.9 is what is currently available in the repository. While not the most recent version, this one should be reliable and sufficient for fast language testing.

1. You can use the yum package manager to obtain this version. First, update your local package index by typing:
yum update
yum install nodejs

To confirm installation, click Y when prompted. If you are asked to restart any services, hit ENTER to proceed with the default settings. Ask the node for its version number to confirm the installation was successful:

node -v

This is all there is to getting started with Node.js if the package in the repositories meets your needs. You should typically install npm, the Node.js package manager, as well. You can accomplish this by using yum to install the npm package:

2. You don’t need to install npm individually because the NodeSource nodejs package includes both the node binaries and npm.

By using apt and the NodeSource PPA, you have now successfully installed Node.js and npm. The installation and management of several Node.js versions are covered in the section that follows.

yum install npm

3. The Node Version Manager is Used to Install Node

The Node Version Manager, or nvm, is a further flexible method of installing Node.js. You can simultaneously install and maintain numerous independent Node.js versions and their corresponding Node packages with this piece of software.

The project’s GitHub page can be accessed to learn how to install NVM on a Rhel 9 computer. The README file is displayed on the main page. Copy the curl command from there. This will provide you with the installation script’s most recent version.

It is usually a good idea to audit the script to ensure it isn’t doing anything you disagree with before papering the command through to bash. Remove the | bash element from the end of the curl command to accomplish that:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh

Make sure you understand the adjustments it is making by taking a look. Run the command once more with | bash appended after you are finished. As of right now, the script can be downloaded and run by typing: The URL you use will change based on the most recent version of nvm.

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

The nvm script will be installed on your user account as a result. You need to source your.bashrc file first before using it:

source ~/.bashrc

You can now inquire NVM about the Node versions that are offered:

nvm list-remote

The list is pretty lengthy! Any of the release versions you see can be typed to install a particular version of Node. For example, you can enter the following to obtain version v16.14.0 (another LTS release):

nvm install v16.14.0

If you type: you can view the various versions you have installed.

nvm list
Author

by admin

bg

Subscribe to our Newslatter

Sign Up to Our Newsletter to Get Latest Updates & Services

mail box