How to install/uninstall Node.js and npm on Microsoft Windows

This tutorial shows how to install and uninstall Node.js and npm on Microsoft Windows.
Installing Node.js and npm is very easy and straight forward using the Windows Installer or Windows binary(zip) file from the node.js web site

Installing using Windows Installer

1) Download Windows Installer

Download the latest Windows Installer(.msi) from node.js web site.

2) Run the downloaded Windows Installer

Run the Installer(.msi) and follow the prompts to review the installation setting (you can accept all default values) and click on install to install both node.js and npm.
Once you click on install, installer installs nodes.js and npm in the specified directory

Installing using Windows binary(zip) file

1) Download Windows binary(zip) file

Download the latest Windows binary(zip) file from node.js web site.

2) Extract the zip file

Extract the downloaded zip file to any directory (example c:/node) where you want to install the node.js and npm. Thats it, installation done!
Add extract directory to windows PATH environment variable (example PATH=c:/node;%PATH)

Test/Validate Installation

To test if Node.js is installed, Open up a new Windows Console and the run the following command at the Windows command prompt. This will print the installed node.js version
node -v

You should see output like this

C:kalliphant>
C:kalliphant>
C:kalliphant> node -v
v7.6.0

C:kalliphant>

To test if npm is installed, Open up a new Windows Console and the run the following command at the Windows command prompt. This will print the installed npm version
npm -v

You should see output like this

C:kalliphant>
C:kalliphant>
C:kalliphant> npm -v
4.1.2

C:kalliphant>

Hello World Sample

To test if every thing working fine, create a small helloWorld.js script with some javascript commands and run it as "node HelloWorld.js" from the windows command prompt


console.log("HelloWorld");
console.log ("Current Date is : " + new Date());

You should get output like below if you run from the command prompt

c:kalliphant>
c:kalliphant>
c:kalliphant>node helloWorld.js
HelloWorld
Current Date is : Sat Feb 25 2016 09:06:12 GMT-0600 (Central Standard Time)

c:kalliphant>
C:kalliphant>

Uninstall Node.js and npm

Uninstall node.js and npm installed using Windows Installer (msi)

To uninstall node.js and npm, Open Windows "Control Panel" -> "Uninstall a program", select Node.js and click on uninstall to uninstaill both node.js and npm

Uninstall node.js and npm installed using Windows Binary (zip)

Delete the extracted directory

Cleanup directories

After the uninstall, look for the following folders and delete them if exists
* Nodejs installed directory
* npm and npm-cache directories from %appdata% directory
* npmrc directory from user home directory ( C:\Users\{User} )

1 Comment

Comments are closed.