# Node JS Environment Setup - Node.js installation

In my previous post, we have discussed about “Introduction to Node JS Platform”. Now we have some idea about what is Node JS and what is not Node JS. In this post, we will discuss about “**How to setup Node JS Base Environment**” in Windows OS and Mac OS X.

#### Node JS Base Environment Setup on Windows

1. Access Node JS Official Website “<https://nodejs.org/en/>”

<figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-official-website-450x281.png" alt=""><figcaption></figcaption></figure>

Here we can find “INSTALL” button. If we want to download latest stable version, we can click on this button. If we want to select Node JS Platform based on our Hardware and Software requirements like Windows 32bit or 64bit OS, please click on “Downloads” button and select your required Node JS version to download.

<figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-Download-Options-403x450.png" alt=""><figcaption></figcaption></figure>

2. Please click on “INSTALL” button to download latest Node JS Platform Version 0.12.0, this is the latest version as of writing this post.

   <figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-installer-windows-450x130.png" alt=""><figcaption></figcaption></figure>
3. Please double click on “node-v0.12.0-x64.msi” file to start Installation process.

   <figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-installation-windows-1-450x352.png" alt=""><figcaption></figcaption></figure>
4. Click on “Next” Button. Accept License Agreement and Click on “Next” Button.

   <figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-installation-windows-2-450x352.png" alt=""><figcaption></figcaption></figure>
5. Choose your required location to install.

   <figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-installation-windows-3-450x352.png" alt=""><figcaption></figcaption></figure>
6. Choose Default values and click on “Install” Button.

   <figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-installation-windows-4-450x352.png" alt=""><figcaption></figcaption></figure>
7. Open Node JS Platform Home in your Explorer.<br>

   <figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-installation-windows-5-450x166.png" alt=""><figcaption></figcaption></figure>

Here we can observe node.exe and npm.cmd files and also “node\_modules” folder. Now onwards, we will refer the following names for easier discussion purpose NODSJS\_HOME= D:\NodeJS.V.0.12.0 NODEJS\_MODULES= D:\NodeJS.V.0.12.0\node\_modules NODEJS\_NPM= D:\NodeJS.V.0.12.0\node\_modules\npm **NOTE**:

* If we use Windows Installer like “node-v0.12.0-x64.msi” or exe file then we doesn’t need to do anything to SYSTEM variables. This installer will take care of everything.
* If we use other formats or if these are missing in your system environment variables, please add the following variables to SYSTEM properties; `PATH=C:\Users\[username]\AppData\Roaming\npm;D:\NodeJS.V.0.12.0\;%PATH%`

&#x20; 8\.  Open Command prompt at NODSJS\_HOME or anywhere like D:\\

<figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-cmd-windows-450x206.png" alt=""><figcaption></figcaption></figure>

<figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-cmd-windows-1-450x205.png" alt=""><figcaption></figcaption></figure>

9. Run “node.exe” command

<figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-cmd-windows-2-450x222.png" alt=""><figcaption></figcaption></figure>

&#x20;      Now we are able to see “>” prompt, that means our Node JS Base Environment Setup is done.

10. Check Node JS Version: Use the following command to know your Node JS Version from Command prompt. `node –v`

    <figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-cmd-windows-version-450x222.png" alt=""><figcaption></figcaption></figure>
11. Exit from Node CLI: We can use “process.exit()” command to exit from Node CLI.

    <figure><img src="https://journaldev.nyc3.digitaloceanspaces.com/2015/03/Node.js-cmd-windows-exit-450x206.png" alt=""><figcaption></figcaption></figure>

&#x20;    We can also use **Ctrl + D** OR use **Ctrl + C Twice** to exit from Node CLI.

#### Node.js Base Environment Setup on Mac OS X

For Mac OS X, download the pkg installer and run it. You will get below screens in order.

[![node.js-mac-os-x-installer](https://journaldev.nyc3.digitaloceanspaces.com/2015/03/node.js-mac-os-x-installer-450x340.png)](https://journaldev.nyc3.digitaloceanspaces.com/2015/03/node.js-mac-os-x-installer.png)[![node.js-mac-os-x-license](https://journaldev.nyc3.digitaloceanspaces.com/2015/03/node.js-mac-os-x-license-450x340.png)](https://journaldev.nyc3.digitaloceanspaces.com/2015/03/node.js-mac-os-x-license.png)[![node.js-mac-os-x-installation](https://journaldev.nyc3.digitaloceanspaces.com/2015/03/node.js-mac-os-x-installation-450x339.png)](https://journaldev.nyc3.digitaloceanspaces.com/2015/03/node.js-mac-os-x-installation.png)[![node.js-mac-os-x-installation-success](https://journaldev.nyc3.digitaloceanspaces.com/2015/03/node.js-mac-os-x-installation-success-450x339.png)](https://journaldev.nyc3.digitaloceanspaces.com/2015/03/node.js-mac-os-x-installation-success.png)

As you can see from above image, **/usr/local/bin** should be in the PATH variable. Usually it’s there by default but you can check it using below command.

```
pankaj:~ pankaj$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin:/usr/local/apache-maven-3.0.5/bin:
pankaj:~ pankaj$ 
```

Below are some sample commands to check the version and start Node CLI and exit it.

```
pankaj:~ pankaj$ node -v
v0.12.1
pankaj:~ pankaj$ node
> process.exit();
pankaj:~ pankaj$ node
> 
(^C again to quit)
> 
pankaj:~ pankaj$ 
```

Before starting some simple Node JS examples, we will discuss about **Major Components of Node JS Platform** in next post.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.x-or.cloud/tutorials/nodejs/node-js-environment-setup-node.js-installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
