To install NodeJS run:
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:
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:
Fill the required fields and end the installation, then type:
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:
To get started with the Nodejs’ tutorial install learnyounode by running:
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:
This menu is the workshopper menu, you can start by hitting ENTER at HELLO WORLD and follow the instructions to get started with Nodejs.
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.
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.