Tutorial

Node JS Environment Setup - Node.js installation

Published on August 3, 2022
author

Rambabu Posa

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/Node.js-official-website 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. Node.js-Download-Options
  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. Node.js-installer-windows
  3. Please double click on “node-v0.12.0-x64.msi” file to start Installation process. Node.js-installation-windows-1 Click on “Next” Button. Accept License Agreement and Click on “Next” Button. Node.js-installation-windows-2
  4. Choose your required location to install. Node.js-installation-windows-3
  5. Choose Default values and click on “Install” Button. Node.js-installation-windows-4
  6. Open Node JS Platform Home in your Explorer. Node.js-installation-windows-5 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%
  7. Open Command prompt at NODSJS_HOME or anywhere like D:\ Node.js-cmd-windows Node.js-cmd-windows-1
  8. Run “node.exe” command Node.js-cmd-windows-2 Now we are able to see “>” prompt, that means our Node JS Base Environment Setup is done.
  9. Check Node JS Version: Use the following command to know your Node JS Version from Command prompt. node –v Node.js-cmd-windows-version
  10. Exit from Node CLI: We can use “process.exit()” command to exit from Node CLI. Node.js-cmd-windows-exit 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 node.js-mac-os-x-license node.js-mac-os-x-installation node.js-mac-os-x-installation-success 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.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors
Default avatar
Rambabu Posa

author

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.