English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The installation of Node.js is a simple task. We just need the correct steps. In this tutorial, we will learn to set up the environment for Node.js and the prerequisites for starting to develop Node.js applications.
The JavaScript programming language is used for Node.js application development. The source file extension for Node.js applications is “.js”. Any text editor is sufficient to write Node.js code and save it as a .js file. To interpret the instructions written in the source .js file, a Node.js interpreter is required. Node.js can be provided as a binary distribution.
From [https://nodejs.org/download/release/latest/]Download the latest binary distribution. According to the operating system and architecture, download the appropriate software package. The size will be less than20MB.
The following is the latest software package for writing this tutorial (for x64The latest software package available when ()
OS | Package |
Linux | node-v8.4.0-linux-x64.tar.gz |
MacOS | node-v8.4.0-darwin-x64.tar.gz |
Windows | node-v8.4.0-win-x64.zip |
SunOS | node-v8.4.0-sunos-x64.tar.gz |
After the download is complete, unzip the software package and include it in the system path variable.
Go to the downloaded folder, open the terminal here, and execute the following command.
$ export PATH=$PATH:/usr/local/nodejs/bin
After adding the route, please close the terminal and then reopen it.
To verify if the nodejs path has been added to the PATH environment variable, please run the following command:
console.log("Hi there! This is Node.js!")
And run the following command from the command prompt or terminal in the verifyNode.js script file directory.
$ node verifyNode.js Hi there! This is Node.js!
The following is the syntax for running Node.js files using the Node command-line interface:
~$ node <file_name>
In this Node.js tutorial, we learned how to install Node.js on a computer and verify the installation by executing the example script (.js) file.