DüğümJS

Installing and learning NodeJS on Debian and Ubuntu

Installing and learning NodeJS on Debian and Ubuntu
PHP is the world's most used programming language for websites despite experienced developers admit the superiority of other languages like NodeJS or Ruby on rails for web applications.

Node JS is based on JavaScript, it is faster than PHP and has very better performance with interactive applications. The language Nodejs is easy to learn and even more if you already know a little of JavaScript.

In this tutorial you'll get explained how to install Node JS on Debian and Ubuntu. If you don't have previous knowledge on JavaScript basics avoid reading the section of this article called “NodeSchool: learn Node JS easy”, when reaching that section omit it and go directly to the next one called “Javascript on NodeSchool”.

To install NodeJS run:

apt install nodejs

You can run nodejs -v to make sure you installed it properly.

Node JS uses npm as default package manager. Type npm to see if you have it installed:

If you get an error instead of npm's man page run:

apt install npm

Let's check the npm packages manager installing MongoDB, first of all, create a directory dedicated to NodeJS (create it by running mkdir< DIRECTORYNAME>). Before using npm we need to start a new project and setup a package.json, a package.json must contain it's name, description, version, link, keywords, author and license. To start a new project run:

npm init

Fill the required fields and end the installation, then type:

npm install mongodb

In my case it was previously installed so it only updated a package. As you can see the basic syntax is easy as apt.

NodeSchool: learn Node JS easy:

NodeSchool is a great multilingual website to learn Nodejs development. If you don't know JavaScript you may want to avoid the next steps and go directly to the end of the article to see the way to get started with JavaScript before trying Nodejs.

To get started with the Nodejs' tutorial install learnyounode by running:

npm install -g learnyounode

The parameter -g instructs a global installation, a Nodejs global installation will install the package as global module, otherwise the installation would be only for the current project.

After installing learnyounode run it by typing in the terminal:

learnyounode

This menu is the workshopper menu, you can start by hitting ENTER at HELLO WORLD and follow the instructions to get started with Nodejs.

Javascript on NodeSchool

At NodeSchool we can also learn JavaScript and HTML. To get started with NodeJS is better to have previous knowledge on JavaScript, after installing nmp install the workshopper for JavaScript by typing:

npm install -g javascripting

Note: The parameter -g instructs a global installation, a Nodejs global installation will install the package as global module, otherwise the installation would be only for the current project.

Then run

javascripting

The JavaScripting menu will guide you through the course to get started with JavaScript, press ENTER on the introduction to get started and follow the instructions.

I hope you found helpful this article to get started with Nodejs, a very powerful language for web programming. Keep following LinuxHint for more tips and updates on Linux.

How to Install and Play Doom on Linux
Introduction to Doom The Doom Series originated in the 90s after the release of the original Doom. It was an instant hit and from that time onwards th...
Vulkan for Linux Users
With each new generation of graphics cards, we see game developers push the limits of graphical fidelity and come one step closer to photorealism. But...
OpenTTD vs Simutrans
Creating your own transport simulation can be fun, relaxing and extremely enticing. That's why you need to make sure that you try out as many games as...