This is the second article in series of Developing SSG using Node.
In order to follow this session you need four software. You need one text-editor to write a program, which you already have. I am going to use gEdit. After that, to run our Node program, we need a terminal, which is also you have. I am going to use Terminology. Then you need Node itself, because that is the actual software who understand your Node code. But, don't worry, installing Node is not that complex.
I am assuming that we all have Debian based GNU/Linux system. So, the installation command for Node should be,
$ sudo apt install nodejs
This will install the
nodejs on your system. You can confirm the installation by running the,
$ nodejs --version v4.2.6
If you open the official website of Node, then you will find that the latest version of Node is
v10.4.0. So, we need to update our installed version with latest one. To do so, you first need to install something called NPM or Node Package Manager. You can install the NPM by running,
$ sudo apt install npm
And you can confirm the installation of NPM by running,
$ npm --version 3.5.2
npm is also old. But, we don't need the latest one for now.
Now to update the Node, run the following command -
$ sudo npm install -g n
$ sudo n latest
Let's wait for the process to complete. After the process completion, you can run the following command to check the version of Node.
$ node --version 10.4.0
Note that, I have used
node instead of
nodejs and we are going to use
node for the rest of our session.
Looks like we are done with installation. We now have text-editor, terminal, Node and NPM. We have not installed NPM only to update Node, there are other usage of it as well and we will use this NPM a lot later during the session.
Now, why not write
hello, world program and confirm the runtime environment of Node?