Through this Article, we are going to discuss setting up Node.js development Environment.
Step 1. Go to Node.js website and download the Node.js software which is suitable to your Operating System. For Windows you will see an installer to enable to ease the installation.
Step 2. Once it is downloaded, start installing it; follow the default settings and complete the installation.
Step 3. After the installation, you will see it sets required environment variables to enable to access Node.js from the command prompts or terminal windows. Also notice that, it installs very useful npm
package manager.
npm
(Node Package Manager) is useful to install the required modules for your program. It also automatically installs the dependencies of the module. So, you no need to worry about looking for any dependencies of the module.
Step 4. Type node
at the command prompt and you will see a command line interface opened to allow you to Run JavaScript.
C:\>node > 1+2 3 >
Step 5. Let’s write a simple JavaScript program, which displays “Hello, World!” message on the console window. And run it through Node.js. The code looks like below; and the file name is “hello.js”;
// hello.js console.log("Hello, World!");
Now, type the below command at command prompt.
C:\>node hello.js Hello, World!
Observe that, our JavaScript program was successfully executed and printed the message on the console window.
Now Node.js development environment is ready to play with JavaScript.
</> Michael