How to install Node.js (on Arch-based Systems)

NSerus
2 min readMar 20, 2021

But First, what is Node.js?

Node.js is an open-source JavaScript code interpreter that works on the server-side. This platform permits programmers as ourselves quick n’ easy developing in the network, in real time and with great stability.

Now that we (in a very general way) know what is Node.js, let’s proceed to the installation.

Installation Node.js !!

This installation will be made on Manjaro KDE !!!

We are going to get the Node.js package from the pacman repository.

sudo pacman -S nodejs

Although this process would be much more intuitive in the pamac AppStore it’s better to get used on the terminal since it’s more versatile.

Testing on Console

For a quick test to verify if everything is working, let’s of course make an Hello World. Just write the following code on a JavaScript (.js) file :

console.log(‘Hello World!.’);

And run this file on a terminal on that directory :

  • For opening the terminal on the directory use the `cd` and `ls` commands to find the file or use dolphin like this:
  • And to run the file just use following command:
node <FileName>.js

Testing on Server

If you want to test it on a server, you can, very easily actually.

Just use the following code on a JavaScript file(if you want to know what it does just follow the comments) and run it in the terminal like before.

var http = require(“http”); //required to save the result in this variable and send to serverhttp.createServer(function (request, response){

//Send Header HTTP to know it’s a server \/
//HTTP Status 200 : OK // Content Type: text/plain
response.writeHead(200, {‘Content-Type’:’text/plain’});
response.end (‘Hello World Server Version\n’); //text to input on server
}).listen(8081);
//Printing the message
console.log(‘Copy this http://127.0.0.1:8081/ to your fav browser (yes the server is running)');
Note: Firefox is too “secure” for this, use chromium, but only for this (cause in the real world you need security)

--

--