Instructions for installing Node.js

If you want to set up node.js environment on your personal computer, you must have 2 software on your computer.

Install Node.js internally

If you want to set up node.js environment on your personal computer, you must have 2 software on your computer. That is: 1) Text Editor (for example: Nodepad ++); 2) binary Nodejs installer.

Text Editor

It will be used to edit your program. For example, some Editor on Windows like Nodepad, vi or vim (on Linux) .

The file you create on your editor is called a source file (source file) and contains source code programs. Source files for Node.js are often named with the ".js" extension format.

Before starting this program, make sure you have a used text editro and experience in writing computer programs, storing files and executing it.

Install Node.js Runtime

Your source code is written in simple Javascript snippets. The Node.js interpreter will be used to compile and execute Javascript code.

Nodejs installed versions are available for 32-bit and 64-bit operating systems of Linux, Mac, Window .

The following section explains the steps to install Node.js binary on different operating systems.

Download Node.js

Download the latest version of Node.js from the Node.js Downloads page. At the time of this tutorial, the latest versions correspond to the following operating systems:

OSArchive nameWindows node-v0.12.0-x64.msi Linux node-v0.12.0-linux-x86.tar.gz Mac node-v0.12.0-darwin-x86.tar.gz SunOS node-v0.12.0-sunos-x86. tar.gz

Install Node.js on UNIX / Linux / Mac OS X, and SunOS

Based on the operating system architectures, downloading and extracting node-v0.12.0-osname.tar.gz in the / tm directory and finally extracting it into the / usr / local / nodejs directory. For example:

 $ sudo apt-get install nodejs 

Add / usr / local / nodejs / bin to the PATH environment variable:

OS ResultLuxux export PATH = / usr / local / nodejs / bin Mac export PATH = $ PATH: / usr / local / nodejs / bin FreeBSD export PATH = $ PATH: / usr / local / nodejs / bin

Install Node.js on Windows

Use MSI file and follow the instructions that appear when installing Node.js. By default, the Node.js installer is stored at C: Program Filesnodejs.

Does the Node.js installation process succeed?

Create a js file named main.js on the computer (Windows or Linux) with the following code:

 /* Hello, World! Vi du kiem tra cai dat node.js */ console . log ( "Hello, World!" ) 

Now execute main.js using the Node.js compiler to see the results:

 $ node main . js 

If everything succeeds, after compiling it will produce the result:

 Hello, World! 

According to Tutorialspoint

Last lesson: What is Node.js?

Next lesson: Module in Node.js

4 ★ | 1 Vote