Node.js has unlimited features but some of the most nominated that make it a JS developer’s choice are mentioned here. It comes with the MIT license having a single threaded model. It is asynchronous which means it never waits for the previous API’s response and outputs the data in chunks (no buffering).
Install Node.js on Linux Mint 21
To install Nodejs on Linux Mint 21 system, follow the steps mentioned below:
Step 1: Update the system’s repository with the help of the given command to upgrade all packages up-to-date:
Step 2: In this step, you are required to install all the dependencies as they are prerequisite of it; so, execute the command given below:
Step 3: Once you installed all the required dependencies, run the mentioned command to get Node-source repository in your system:
Step 4: Now you can install the Node.js application on Linux Mint 21 system after successfully set node source repository:
Step 5: Execute the following command to verify installed of Node.js version on system:
Test Node.js on Linux Mint 21
Create a simple JavaScript file using nano editor and type a simple program in it:
const port = 3000;
const server = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(‘Hello This is LinuxHint! and I am Sam\n’);
});
server.listen(port, () => {
console.log(`Listening Port ${port}`);
});
Save this program on the editor and open any browser to see the output. For this run the command given below in the terminal. This would start running a web server on local port 3000:
To verify successful installation of Nodejs, type in browser:
How to Remove Node.js from Linux Mint 21
To uninstall Node.js from the Linux Mint 21 system, the mentioned command would be executed in terminal:
Conclusion
Node.js is an open-source JavaScript runtime used to create JavaScript based projects. It is popular among developers who wish to build applications in a non-blocking environment.
In this article, we have mentioned in-depth details about the installation process of Node.js on the Linux Mint 21 system. We have also run a test file to show its web server working. Moreover, we have also mentioned the command to uninstall it.